Reputation: 1374
I wrote an rspec test it { should have_title("Title | Subtitle") }
When I go to said page from localhost I see the correct title displayed, however, when I run my rspec test, I get:
Failure/Error: it { should have_title("Title | Subtitle") }
expected #has_title?("Title | Subtitle") to return true, got false
How can I ask rspec to print out the title it found instead?
Thanks
Upvotes: 0
Views: 50
Reputation: 18845
has_title?
is a capybara matcher. rspec is not involved there, that matcher just returns true or false.
if you want to get the title, you need to do something like expect(page.title).to eql('blah')
Upvotes: 1