Rspec, Rails: how to test private methods of controllers?
Use #instance_eval
@controller = AccountController.new@controller.instance_eval{ current_account } # invoke the private method@controller.instance_eval{ @current_account }.should eql ... # check the value of the instance variable
I use send method. Eg:
event.send(:private_method).should == 2
Because "send" can call private methods
Where is the current_account method being used? What purpose does it serve?
Generally, you don't test private methods but rather test the methods that call the private one.