Undefined method `has' in integration test

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!

On Sun, Feb 21, 2010 at 9:25 PM, drewB [email protected] 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?

On Sun, Feb 21, 2010 at 5:25 PM, drewB [email protected] 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?

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.

Any thoughts on how to get the matchers included?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs