On Oct 10, 2008, at 11:50 PM, Mano ah wrote:
How to solve the below error
1)
NoMethodError in 'LoginController index should get successfully'
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.status
./login_controller_spec.rb:9:
2)
NoMethodError in 'LoginController index should render 202 file'
undefined method `render_template' for
#<Spec::Example::ExampleGroup::Subclass_1
:0x47bc128>
./login_controller_spec.rb:13:
"Spec::Example::ExampleGroup::Subclass_1" - this part suggests it's
not running as a controller spec. A few things:
1. Is the file in correct path? It should be in the path
#{RAILS_ROOT}/spec/controller/my_controller_spec.rb
2. Have you installed the two plugins, and run "script/generate rspec" ?
3. (I don't recommend this, but:) You can force this to run as a
controller spec by passing a :type => :controller to describe, like so:
describe "my controller", :type => :controller do
...
end
4. Worse comes to worse, try running the generator to get some example
code:
./script/generate rspec_controller MyController
That should generate a sample spec. You could work from there.
Hope that helps,
Scott
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users