undefined method `include' #4

Closed
daz4126 opened this Issue Nov 28, 2010 · 4 comments

Comments

Projects
None yet
2 participants

daz4126 commented Nov 28, 2010

I'm following the code on the Sinatra website (http://www.sinatrarb.com/testing.html#bacon)

When I run >bacon test.rb, I get the following output:
The HelloWorld App
0 specifications (0 requirements), 0 failures, 0 errors
./test.rb:8: undefined method include' for #<Bacon::Context:0xb750d798> (NoMethodError) from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/../lib/bacon.rb:139:ininstance_eval'
from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/../lib/bacon.rb:139:in run' from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/../lib/bacon.rb:41:inhandle_specification'
from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/../lib/bacon.rb:139:in run' from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/../lib/bacon.rb:284:indescribe'
from ./test.rb:7
from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/bacon:115:in load' from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/bacon:115 from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/bacon:114:ineach'
from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/bacon:114
from /usr/bin/bacon:19:in load' from /usr/bin/bacon:19 ./test.rb:8: undefined methodinclude' for #Bacon::Context:0xb750d798 (NoMethodError)
from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/../lib/bacon.rb:139:in instance_eval' from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/../lib/bacon.rb:139:inrun'
from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/../lib/bacon.rb:41:in handle_specification' from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/../lib/bacon.rb:139:inrun'
from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/../lib/bacon.rb:284:in describe' from ./test.rb:7 from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/bacon:115:inload'
from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/bacon:115
from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/bacon:114:in each' from /usr/lib/ruby/gems/1.8/gems/bacon-1.1.0/bin/bacon:114 from /usr/bin/bacon:19:inload'
from /usr/bin/bacon:19

Any ideas what the problem is?

cheers,

DAZ

Contributor

cldwalker commented Nov 28, 2010

Yep. The scope you're including into is an object, not a class. Try extend Rack::Test::Methods

daz4126 commented Nov 28, 2010

Thanks!

That works fine. Does this mean that the code on the Sinatra website is incorrect?

Thanks again,

DAZ

Contributor

cldwalker commented Nov 28, 2010

Yep

daz4126 commented Nov 28, 2010

Thanks, good to know it's not me! I'll try to get the webpage updated.

DAZ

@spaghetticode spaghetticode added a commit to spaghetticode/rack-flash that referenced this issue Dec 6, 2013

@spaghetticode spaghetticode fix test_flash.rb as per chneukirchen/bacon#4 6d23a09

This issue was closed.

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