[rspec-users] RSpec book errata #57 - undefined method `include' : what to do?

31 views
Skip to first unread message

Kristian Mandrup

unread,
Jun 1, 2010, 5:53:14 PM6/1/10
to rspec...@rubyforge.org
http://pragprog.com/titles/achbd/errata

nr 57:
Ruby 1.8.7
expected [] to include "Welcome to Codebreaker!"

Ruby 1.9.1
undefined method `include' for #<Object:0x80b32c90> (NoMethodError)
---

class Output
def messages
@messages ||= []
end

def puts(message)
messages << message
end
end

Then /^I should see "([^\"]*)"$/ do |message|
output.messages.should include(message)
end
---

I am using Ruby 1.9.2 with cucumber 0.7.3 and Rspec 2.0.0.beta.9.
Is there a fix for this somewhere for this stack of gems and ruby
version?

_______________________________________________
rspec-users mailing list
rspec...@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Kristian Mandrup

unread,
Jun 1, 2010, 9:08:21 PM6/1/10
to rspec...@rubyforge.org
One hack "solution" looks like this :P

output.messages.include?(mark).should

Matthew Sullivan

unread,
May 16, 2014, 8:57:42 AM5/16/14
to rs...@googlegroups.com, rspec-users
I know this is VERY late, but I ran across the same problem, so (for once) I am sharing how I solved it.

Your hack only brings me to the next problem: undefined method of "should". And the reason is I hadn't actually installed the RSpec gem on the machine I was using (oops) and I didn't require spec in my env.rb file. The second part seems like errata for the book.
Reply all
Reply to author
Forward
0 new messages