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.
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 errorsHints
Currently, the application contains a single route (at
/
, seeconfig/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 commandrails 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 thefeature
type includes helper methods for simulating browser actions in tests. Eachit
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
1 exercise tests have passed. There are 44 in total. You will solve multiple at once towards the end.