Response.should have_text leads to undefined method `has_text?'

One of my controllers directly renders some JSON output that I would
like to test with RSpec. For that I use ‘response.should
have_text(“foobar”)’ in my spec file, but that leads to a

Failure/Error: response.should have_text(“enim”)
undefined method `has_text?’ for #<ActionController::TestResponse:
0xb6736944>

I read here somewhere that webrat should be in the Gemfile, but that
also did not solve the problem.

Best regards,
Kai

On Sep 30, 2010, at 3:50 PM, turkan wrote:

One of my controllers directly renders some JSON output that I would
like to test with RSpec. For that I use ‘response.should
have_text(“foobar”)’ in my spec file, but that leads to a

Failure/Error: response.should have_text(“enim”)
undefined method `has_text?’ for #<ActionController::TestResponse:
0xb6736944>

I read here somewhere that webrat should be in the Gemfile, but that
also did not solve the problem.

The webrat matcher is contain:

response.should contain(“enim”)

HTH,
David

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