[rspec-users] undefined method `contain' for #<RSpec::Core::ExampleGroup::Nested_1:0x10595b1a8>

Chad Ostrowski chad.ostrowski at gmail.com
Wed Nov 10 06:44:22 EST 2010

Here's my Gemfile:

group :development, :test do
>   gem 'rspec-rails', '2.0.0'
>   gem 'cucumber-rails', '0.3.2'
>   gem 'capybara', '0.4.0.rc'
> end

and here's my spec:

describe "welcome/index.html.haml" do
>   it "displays 'Problem Child' in the header" do
>     render
>     rendered.should contain("Problem Child")
>   end
> end

This results in the error given in the subject:

>   1) welcome/index.html.haml displays 'Problem Child' in the header
>      Failure/Error: rendered.should contain("Problem Child")
>      undefined method `contain' for
> #<RSpec::Core::ExampleGroup::Nested_1:0x10595b1a8>

Does the "contain" matcher come with Webrat? Is that why the RSpec book
seems to be lying to me? I'm trying to get the feel of RSpec and I love the
idea of speccing views. I've been approximately following along with The
RSpec Book. I'm using Capybara instead of Webrat because Webrat wasn't
playing well with Rails 3 (I forget the details).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20101110/cac35c3f/attachment-0001.html>

More information about the rspec-users mailing list