rspec should include tries to chomp an array-Collection of common programming errors

[EDIT] The issue is corrected in rspec-expectations, on master branch. You can fix it by using this in your Gemfile:

gem 'rspec-rails', '~> 2.9'
gem 'rspec-expectations', :git => "https://github.com/rspec/rspec-expectations.git", :branch => 'master'

I encountered the same issue on Rails 3.0.12 with rspec 2.9.0. Reverting to rspec 2.8.0 / rspec-rails 2.8.1 did the trick.

I raised an issue on Github, rspec/rspec-expectations, we’ll see if it’s really a bug.

For reference, this is the step definition:

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

… 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$/'

Originally posted 2013-11-09 21:40:06.