Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialWilliam Peterson
5,103 Pointsundefined method `before_filter'
As per the Video and the devise github instructions:, I added the line: before_filter :authenticate_user! to statuses_controller_test.rb code:
require 'test_helper'
class StatusesControllerTest < ActionController::TestCase before_filter :authenticate_user!
setup do @status = statuses(:one) end ...
When I run it (output):
C:\Sites\treebook (master)
? ruby -Itest test/controllers/statuses_controller_test.rb
test/controllers/statuses_controller_test.rb:4:in <class:StatusesControllerTest>': undefined method
before_filter' for StatusesControllerTest:Class (NoMethodError) from test/controllers/statuses_controller_test.rb:3:in <main>
any help?
I should mention:
- I am using rails4 and ruby 2
- I checked both the project files and the github files and none of these have that line in the testing file.
1 Answer
William Peterson
5,103 PointsI figured it out: I was adding this line to the Statuses_controller_test.rb, where i should have been adding it to the statuses_controller.rb itself.
Thank you for listening.