Given an author named 'Alan Turing'
When a user visits Turing's details page
Then it should show Turing's first name, last name and homepage
Hints
A 'show' page displays an author's details.
In a test, visit the show page of @alan with visit author_path(@alan).
Create a separate file for author show page feature tests. Make sure it ends with _spec.rb, so that RSpec recognizes it as a test and runs it.
Test for existence of text on a page using the have_textmatcher:
expect(page).to have_text(...).
Create a show action on the AuthorsController and a 'show' view (app/views/authors/show.html.erb).
Here is the relevant section (5.7) of the Rails Guide.
Tip:FactoryBot.create :author creates and saves a valid author object in your tests. If you un-comment the code in spec/factories/authors.rb, the author will be initialized with meaningful values.
Scenario
Given an author named 'Alan Turing' When a user visits Turing's details page Then it should show Turing's first name, last name and homepage
Hints
A 'show' page displays an author's details. In a test, visit the show page of
@alan
withvisit author_path(@alan)
.Create a separate file for author show page feature tests. Make sure it ends with
_spec.rb
, so that RSpec recognizes it as a test and runs it. Test for existence of text on a page using thehave_text
matcher:expect(page).to have_text(...)
.Create a
show
action on the AuthorsController and a 'show' view (app/views/authors/show.html.erb
). Here is the relevant section (5.7) of the Rails Guide.Tip:
FactoryBot.create :author
creates and saves a valid author object in your tests. If you un-comment the code inspec/factories/authors.rb
, the author will be initialized with meaningful values.Error
7 exercise tests have passed. There are 44 in total. You will solve multiple at once towards the end.