I'm currently writing fairly simple test case(still learning). I'm asserting whether about page has about h1.
This is my test :
describe "about verification page" do
before { visit about_path }
it { should have_selector('h1', text: 'About') }
end
My test fails with this reason :
Failure/Error: it { should have_selector('h1', text: 'About') }
expected #has_selector?("h1", {:text=>"About"}) to return true, got false
But when I go to my about page and type $('h1')
I get About
and I can see the text in browser.
What am I doing wrong with this? Or how can I get a value of h1
so I can print it and see what am I actually getting?