Sha256: de5df82c47fe9f53aa11710095b59ab5949b47fe140a0b40fed9d8469b96b183

Contents?: true

Size: 436 Bytes

Versions: 5

Compression:

Stored size: 436 Bytes

Contents

module ControllerHelpers
  def sign_in(user = double('user'))
    if user.nil?
      allow(request.env['warden'])
        .to receive(:authenticate!)
        .and_throw(:warden, { scope: :user })

      allow(controller).to receive(:current_user).and_return(nil)
    else
      allow(request.env['warden']).to receive(:authenticate!).and_return(user)
      allow(controller).to receive(:current_user).and_return(user)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
voyage-1.44.0.4 lib/voyage/templates/controller_helpers.rb
voyage-1.44.0.3 lib/voyage/templates/controller_helpers.rb
voyage-1.44.0.2 lib/voyage/templates/controller_helpers.rb
voyage-1.44.0.1 lib/voyage/templates/controller_helpers.rb
voyage-1.0 lib/voyage/templates/controller_helpers.rb