[rspec-users] undefined local variable or method

Guirec Corbel guirec.corbel at gmail.com
Mon Jun 10 22:45:49 UTC 2013


Hi,

I a controller spec like this : 
https://gist.github.com/GCorbel/5753042#file-painting_controller_spec_1-rb. 
(at the top). When I try to run this spec I have this message :

Failure/Error: before { painting.stub(:valid?).and_return(true) }
NameError:
undefined local variable or method ` painting' for 
#<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0x007fb7acbe5cb0>
# ./spec/controllers/painting_controller_spec.rb:10:in `block (4 levels) 
in <top (required)>' But this spec : 
https://gist.github.com/GCorbel/5753042#file-painting_controller_spec_2-rb 
(at the bottom) works perfectly. In the context's before block, the 
painting seem not to be created. Did I do something wrong? Thanks!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20130610/76b9c198/attachment.html>


More information about the rspec-users mailing list