swt2-intro-exercise / rails-exercise-20-Georgy5

rails-exercise-20-Georgy5 created by GitHub Classroom
MIT License
0 stars 0 forks source link

New author page should exist #1

Closed swt2public closed 11 months ago

swt2public commented 11 months ago

Scenario

When a user visits the new author page Then the page should be available at the new_author_path route and should render without errors

Hints

Currently, the application contains a single route (at /, see config/routes.rb), a view (app/views/home/index.html.erb) and a controller (app/controllers/home_controller.rb), connecting them. All available application routes are displayed using the command rails routes.

Before implementing the requested feature, write a test for it. The file spec/features/author/new_author_spec.rb contains the needed test case, it needs to be un-commented.

The describe block defines which aspect will be tested. Specifying the feature type includes helper methods for simulating browser actions in tests. Each it block is a single test case. The test tries to access the path (i.e. the URL) of the "new author" page. This fails because no such path is defined yet.

Run the test (bundle exec rspec) and commit the failing test case.

To make the test pass, see the Rails Guide for creating the appropriate controllers, views and setting up routes for authors. Note: Instead of articles (in the guide), this exercise is concerned with authors.

You can learn more about RSpec, the testing framework here.

Error

Got NameError: undefined local variable or method `new_author_path' for # Did you mean? new_polymorphic_path

1 exercise tests have passed. There are 44 in total. You will solve multiple at once towards the end.

Georgy5 commented 11 months ago

Added Author model and Authors controller as well as Authors resources in routes.rb