Displaying 1 result from an estimated 1 matches for "mock_login".
Did you mean:
mech_login
2007 Jul 09
0
Is it bad to use a shared example in rspec_helper.rb?
...;'t have to include
it in each before call.
Is it bad to use a describe block within the rspec_helper in a rails project
for controller tests?
I have in my spec_helper.rb
describe "an authenticated request", :shared => true do
before( :each ) do
@u = mock_model( User )
mock_login( @u )
end
def mock_login( user )
session[:user] = user
controller.send( :instance_variable_set, :@current_user, user )
controller.stub!( :current_user ).and_return( user )
end
end
which I then share in my relevant controller tests with
it_should_behave_like "an authent...