Forum: RSpec undefined method `has' in integration test

Posted by drewB (Guest)
on 2010-02-22 00:28
(Received via mailing list)
Whenever I use a matcher like response.should have_text in an
integration test I receive the following error:

undefined method `has' for #<ActionController::Integration::Session:
0x7fe07d184038>

Any idea why that is and how to fix it?

Thanks!
Posted by Nicolás Sanguinetti (Guest)
on 2010-02-22 00:32
(Received via mailing list)
On Sun, Feb 21, 2010 at 9:25 PM, drewB <dbatshaw@gmail.com> wrote:
> Whenever I use a matcher like response.should have_text in an
> integration test I receive the following error:
>
> undefined method `has' for #<ActionController::Integration::Session:
> 0x7fe07d184038>
>
> Any idea why that is and how to fix it?

I think—not sure—those matchers are provided by webrat, so probably
you're not requiring it?
Posted by David Chelimsky (Guest)
on 2010-02-22 00:56
(Received via mailing list)
On Sun, Feb 21, 2010 at 5:25 PM, drewB <dbatshaw@gmail.com> wrote:
> Whenever I use a matcher like response.should have_text in an
> integration test I receive the following error:
>
> undefined method `has' for #<ActionController::Integration::Session:
> 0x7fe07d184038>
>
> Any idea why that is and how to fix it?

What versions of rails, rspec, and ruby are you using? Also, where is
the file in question and how are you running it?
Posted by drewB (Guest)
on 2010-02-22 01:26
(Received via mailing list)
I require webrat in spec_helper (Spork.prefork).

versions:

rails 2.1.2
rspec 1.3.0
rspec-rails 1.3.2
ruby 1.8.7

The file is located at 'spec/integration/landing_page/
Ianding_page_spec.rb'. I am running 'spec spec/integration/
landing_page/landing_page_spec.rb'

I am also using the rspec-integration plugin (http://github.com/
tricycle/rspec-integration).  While investigating further, I found
that removing the plugin causes other matchers to stop working (e.g.
response.should be_success).  I am guessing that no matchers are
available by default when using rspec for integration testing (outside
of cucumber) at least the way I have it set up.
Posted by drewB (Guest)
on 2010-02-22 22:29
(Received via mailing list)
Any thoughts on how to get the matchers included?
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.