While going through the Learn Rails book written by Michael Hartl, I’m stumped on one of the exercises.
Learn Rails by Example by Michael Hartl
“Add tests for micropost pagination”
My incorrect test, placed in the ‘describe “for signed-in users” do’ is as follow:
describe "pagination" do
before(:all) do
30.times { FactoryGirl.create(:micropost, user: user) }
end
after(:all) { user.feed.delete_all }
page.should have_selector('div.pagination') }
it "should list each micropost" do
user.feed.paginate(page: 1).each do |user|
page.should have_selector('li', text: user.name)
end
end
end
The test shows as passed no matter if I do page.should or page.should_not.
Any ‘hint/help’ would be appreciated
While browsing through some of the repos I found the answer to my question – I needed to visit the root_path again, after creating the additional microposts.