Sha256: b4e6f67be777436bcbc1e473e35a9106a121984f0b2894ce8533aa6c6e107f0e
Contents?: true
Size: 622 Bytes
Versions: 2
Compression:
Stored size: 622 Bytes
Contents
module ControllerMacros # This method uses warden # sign in a given user or creates one automatically # nil allows to force not logged in user def sign_up_and_in(user_attributes=FactoryGirl.attributes_for(:user)) if user_attributes create_user(user_attributes) allow(request.env['warden']).to receive(:authenticate!).and_return(@user) allow(controller).to receive(:current_user).and_return(@user) else allow(request.env['warden']).to receive(:authenticate!).and_throw(:warden, {:scope => :user}) allow(controller).to receive(:current_user).and_return(nil) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
devise_meteor-0.1.1 | spec/support/controller_macros.rb |
devise_meteor-0.1.0 | spec/support/controller_macros.rb |