should include calls chomp for a String value #130

rchampourlier opened this Issue Apr 1, 2012 · 2 comments

2 participants


I encountered this issue and found

In my case, the issue happens with rspec 2.9.0 / rspec-rails 2.9.0, with Rails 3.0.12 when I use the include matcher for a String attribute.

Here is the concerned code:

Then /^(?:I|they) should see "([^"]*?)" in the email body$/ do |text|
  current_email.default_part_body.to_s.should include(text)

... the step in the feature:

step %{I should see "changer de mot de passe" in the email body}

... which was raising:

undefined method `chomp' for ["changer de mot de passe"]:Array (NoMethodError)
  ./features/step_definitions/email_steps.rb:110:in `/^(?:I|they) should see "([^"]*?)" in the email body$/'
RSpec member

I believe the underlying issue has already been fixed:


Can you try pinning your gemfile to rspec-expectations master branch on github and see if the issue is fixed?


This is indeed corrected in rspec-expectations/master.

Tested it with this in my Gemfile:

gem 'rspec-rails', '~> 2.9'
gem 'rspec-expectations', :git => "", :branch => 'master'

And thanks for the ultra-fast answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment