If your controller spec never reaches your controller code:
-
Make sure you are signed in.
-
Make sure you are actually triggering a request by saying
get :edit
or something siliar. -
Know that views are not rendered by default for controller specs unless you tell them to (
render_views
).
^
describe UsersController do
describe '#edit' do
it 'should work' do
sign_in
get :edit
end
end
enddefine something like this in your spec_helper.rb:
def sign_in(user = User.new)
controller.instance_variable_set('@current_user', user)
end
Posted by Arne Hartherz to makandra dev (2010-12-02 15:26)