Alexandre Gomes
2012-Jan-15 23:10 UTC
[rspec-users] NoMethodError: undefined method `expect''
Ideas?
ruby-1.9.2-p290 :002 > require ''rspec''
=> true
ruby-1.9.2-p290 :003 > RSpec::Version::STRING
=> "2.8.0"
ruby-1.9.2-p290 :004 > describe ''division by zero'' do
ruby-1.9.2-p290 :005 > expect { 2/0 }.to raise_error
ruby-1.9.2-p290 :006?> end
NoMethodError: undefined method `expect'' for
#<Class:0x007fe272270590>
from (irb):5:in `block in irb_binding''
from
.../.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:201:in
`module_eval''
from
.../.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:201:in
`subclass''
from
.../.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:187:in
`describe''
from
.../.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/dsl.rb:18:in
`describe''
from (irb):4
from .../.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>''
ruby-1.9.2-p290 :007 >
[]s!
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/rspec-users/attachments/20120115/1995c20f/attachment.html>
Michael Guterl
2012-Jan-17 23:23 UTC
[rspec-users] NoMethodError: undefined method `expect''
On Sun, Jan 15, 2012 at 6:10 PM, Alexandre Gomes <alegomes at gmail.com> wrote:> Ideas? > > > ruby-1.9.2-p290 :002 > require ''rspec'' > ?=> true > ruby-1.9.2-p290 :003 > RSpec::Version::STRING > ?=> "2.8.0" > ruby-1.9.2-p290 :004 > describe ''division by zero'' do > ruby-1.9.2-p290 :005 > ? ? expect { 2/0 }.to raise_error > ruby-1.9.2-p290 :006?> ? end > NoMethodError: undefined method `expect'' for #<Class:0x007fe272270590> > from (irb):5:in `block in irb_binding'' > from > .../.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:201:in > `module_eval'' > from?.../.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:201:in > `subclass'' > from?.../.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:187:in > `describe'' > from?.../.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/dsl.rb:18:in > `describe'' > from (irb):4 > from?.../.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'' > ruby-1.9.2-p290 :007 > > > []s! >You need to put your expectations in an it block. describe ''division by zero'' do ? it { expect { 2/0 }.to raise_error } end Best, Michael Guterl