Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 6: Controller test #4

Closed
JWTappert opened this issue Jan 8, 2017 · 1 comment
Closed

Chapter 6: Controller test #4

JWTappert opened this issue Jan 8, 2017 · 1 comment

Comments

@JWTappert
Copy link

JWTappert commented Jan 8, 2017

I have been following along in the book and am trying to run the $ rails test:controllers command but my test is failing. I think its because the view isn't getting the story object properly?

Here is the output from the error message:

Run options: --seed 61443

# Running:

E

Error:
StoriesControllerTest#test_should_get_index:
ActionView::Template::Error: undefined method `name' for nil:NilClass
    app/views/stories/index.html.erb:2:in `_app_views_stories_index_html_erb___1312172176529221963_70288214234340'
    test/controllers/stories_controller_test.rb:5:in `block in <class:StoriesControllerTest>'


bin/rails test test/controllers/stories_controller_test.rb:4



Finished in 0.338105s, 2.9577 runs/s, 0.0000 assertions/s.

1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
@JWTappert
Copy link
Author

The error was in my stories_controller.rb. I added private above the story_params method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant