When a user visits the new author page
Then the page should render
Hints
Currently, the application contains only a single route (the root at '/', see config/routes.rb), a single view (app/views/home/index.html.erb) and a single controller (app/controllers/home_controller.rb), which connects the two.
All available routes of the application can be displayed using rails routes.
Before you begin implementing this feature, write a test to document its absence.
The file spec/features/author/new_author_spec.rb already contains the needed test case, it only needs to be un-commented.
The describe block defines which aspect of the the software will be tested here.
Specifying the feature type automatically includes helper methods that allow to simulate browser actions in a test.
Inside describe, each it block is a single test case.
In this example, the test tries to access the URL of the new-author page.
This fails because no such path is defined yet.
Commit the failing test case.
Now, this test needs to be made to pass. See the Rails tutorial for instructions to create the appropriate controllers, views and setting up routes for authors.
Instead of articles (as in the tutorial), this exercise is concerned with authors.
You can learn more about RSpec, the testing framework, in this documentation
Error
Got NameError: undefined local variable or method `new_author_path' for #
Did you mean? new_polymorphic_path
Scenario
When a user visits the new author page Then the page should render
Hints
Currently, the application contains only a single route (the root at '/', see
config/routes.rb
), a single view (app/views/home/index.html.erb
) and a single controller (app/controllers/home_controller.rb
), which connects the two. All available routes of the application can be displayed usingrails routes
.Before you begin implementing this feature, write a test to document its absence. The file
spec/features/author/new_author_spec.rb
already contains the needed test case, it only needs to be un-commented.The
describe
block defines which aspect of the the software will be tested here. Specifying thefeature
type automatically includes helper methods that allow to simulate browser actions in a test. Insidedescribe
, eachit
block is a single test case. In this example, the test tries to access the URL of the new-author page. This fails because no such path is defined yet.Commit the failing test case.
Now, this test needs to be made to pass. See the Rails tutorial for instructions to create the appropriate controllers, views and setting up routes for authors. Instead of articles (as in the tutorial), this exercise is concerned with authors. You can learn more about RSpec, the testing framework, in this documentation
Error
1/44 exercise tests have passed