module ControllerMacros # def login_admin # before(:each) do # @request.env["devise.mapping"] = Devise.mappings[:admin] # sign_in FactoryGirl.create(:admin) # Using factory girl as an example # end # end def login_non_admin_user before(:each) do @request.env["devise.mapping"] = Devise.mappings[:user] user = FactoryGirl.create(:pwb_user, email: 'non_admin@pwb.com', password: '123456', admin: false) # user.confirm! # or set a confirmed_at inside the factory. Only necessary if you are using the "confirmable" module sign_in user end end def login_admin_user before(:each) do @request.env["devise.mapping"] = Devise.mappings[:user] user = FactoryGirl.create(:pwb_user, email: 'admin@pwb.com', password: '123456', admin: true) # user.confirm! # or set a confirmed_at inside the factory. Only necessary if you are using the "confirmable" module sign_in user end end end