Hi all,
I've just started doing functional testing in Rails. I want to test my
controller whether it displays the page correctly or not. This is the
test code that I have written:
================================
fixtures :all
def test_index
get(:index, {'code' => 'PR', 'project_id' => '9999'})
end
But when I ran this test I encounter this error:
1) Error:
test_index(ReleasesControllerTest):
NoMethodError: undefined method `releases' for nil:NilClass
vendor/rails/activesupport/lib/active_support/whiny_nil.rb:52:in
`method_missing'
app/controllers/releases_controller.rb:46:in `index'
And this is how my controller looks like:
@project = Project.find_by_code(params[:code])
@releases = @project.releases
===============================
Why do I get this error?
* Shouldn't the releases be a instance variable instead of method?
* Shouldn't the instace be created because I have passed the parameter?
Did I miss anything here? Because I got this from reading the rails
guide. Thanks for the assistance.
Kind regards,
--
Certified Scrum Master
http://blog.scrum8.com | http://jobs.scrum8.com | http://twitter.com/scrum8
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=.