[rspec-users] response.should have_content("1 movie") does not seem to work for me
lists at ruby-forum.com
Thu Jun 14 07:40:14 UTC 2012
I have worked quite to near the end of The RSpec Book, but now I'm
having some troubles.
I'm trying to get the last few Cucumber steps to work, which are:
Then /^Caddyshack should be in the Comedy genre$/ do
response.should have_content("1 movie")
So far everything's working, but the have_content("1 movie") doesn't,
although I have hard-coded the string into the view, and when displaying
what Webrat sees using save_and_open_page, the string definitely is
Contains 1 movie
Edit | Back
This is what Cucumber tells me:
Scenario: Create movie in genre #
Given a genre named Comedy #
When I create a movie Caddyshack in the Comedy genre #
Then Caddyshack should be in the Comedy genre #
expected there to be content "1 movie" in ""
should be in the Comedy genre$/'
features/create_movie.feature:10:in `Then Caddyshack should be in
the Comedy genre'
I'm sort of confused anyway, because in the RSpec book I'm told to use
contains("1 movie"), but this method is not found!
undefined method `contains' for
After some searching on Google I got the hint to use should_contain("1
movie"), and this method seems to be available, but it doesn't seem to
work. Anyways, I'm a bit confused now, because should_contain() was
claimed to be a Capybara thing, and not a Webrat thing, but I never read
something about Capybara in the book, only about Webrat. So what am I
using now, and why?? Is it because the book is a bit old already, and
nowadays Rails uses Capybara by default? Because when removing
from my Gemfile, Cucumber doesn't complain!
Please also see my other post about this question (I'm sorry for having
two posts, I didn't realize they both would be about the same thing):
Thanks a lot for help,
Posted via http://www.ruby-forum.com/.
More information about the rspec-users