Module: AuthenticationHelpers
- Defined in:
- lib/pixelforce_kit/spec_helper.rb
Instance Method Summary collapse
Instance Method Details
#sign_in(user) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/pixelforce_kit/spec_helper.rb', line 27 def sign_in(user) if(user.is_a?(User)) allow(controller).to receive(:current_user).and_return(user) allow(controller).to receive(:authenticate_user!).and_return(true) else allow(controller).to receive(:current_admin_user).and_return(user) allow(controller).to receive(:authenticate_admin_user!).and_return(true) end end |
#sign_out ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/pixelforce_kit/spec_helper.rb', line 37 def sign_out if(user.is_a?(User)) allow(controller).to receive(:current_user).and_return(nil) allow(controller).to receive(:authenticate_user!).and_return(false) else allow(controller).to receive(:current_admin_user).and_return(nil) allow(controller).to receive(:authenticate_admin_user!).and_return(false) end end |