So I was just trying to call a log_in method from user controller in the RSpec as
it "should get the index page" do @user = User.new({ :email => "[email protected]" }) log_in(@user) get 'index' response.should be_success end The result I got is like
1) EmployeesController GET 'index' should get the index page Failure/Error: log_in(user) NoMethodError: undefined method `log_in' for #<RSpec::Core::ExampleGroup::Nested_1:0x4ac0328> # ./spec/controllers/employees_controller_spec.rb:11:in `user_log_in' # ./spec/controllers/employees_controller_spec.rb:16:in `block (2 levels) in <top (required)>' Can someone help me out? Thanks
Edited March 11th, 2011
Here is the log_in method which is in UserController
def log_in(user) session[:current_user] = user.id end
user_log_inorlog_in? Can you include this method?log_inmethod in theUserControllerfrom theEmployeesController? This isn't really possible.