I have user model with role field for user,admin and super admin which are in enum roles. I wrote function in controller_macros.rb for super admin sign in:
def login_super_admin
before(:each) do
@request.env["devise.mapping"] = Devise.mappings[:admin]
sign_in = FactoryGirl.create(:user, :super_admin)
end
end
And i have this test:
context "As super admin" do
login_super_admin
it "renders new page" do
get :new
expect(response).to be_success
end
end
This tests response code is 302, i can't figure out why, i think it never reaches controller new action, because i placed debugger to catch it. Why this happens?
Aucun commentaire:
Enregistrer un commentaire