I've created a learning application using Bort, which is a base app that includes Restful Authentication and RSpec. I've got it up and running and added a new object that requires users to be logged in before they can do anything(before_filter :login_required
in the controller). [edit: I should also mention that the user has_many
of the new class and only the user should be able to see it.]
I've created the new model/controller using Rspec's generators which have created a number of default tests. They all pass if there is no before_filter
but several fail, as should be expected, once the before_filter
is in place.
How do I get the generated tests to run as if there is/is not a logged in user? Do I need a whole batch of matching not logged in - redirect tests? I assume it is some sort of mocking or fixture technique but I am new to RSpec and a bit adrift. Good RSpec tutorial links would also be appreciated.