Reputation: 1975
I'm searching for a CSS class. My HAML is:
.friends
= image_tag 'news-face.png'
%p 15
My test is:
it "Should show friends count on popular feed" do
visit '/'
page.should have_css('.friends')
end
I'm getting an error:
Failure/Error: page.should have_css('.friends')
expected css ".friends" to return something
I've tried should
, should_not
, & have_selector
and can't figure out what's wrong.
Upvotes: 1
Views: 694
Reputation: 1938
It seems that you don't have such element on your page. The best way to figure it out by yourself is to install:
# in your Gemfile
gem 'launchy'
and then just use:
# in Cucumber step
it "Should show friends count on popular feed" do
visit '/'
save_and_open_page
page.should have_css('.friends')
end
With this gem and command you will be able to render this page from your test.
Upvotes: 3