Sha256: 16ee7baf09efc2394c9df5dd63e5e712f1720142031f9be05788a89a532d7446

Contents?: true

Size: 441 Bytes

Versions: 10

Compression:

Stored size: 441 Bytes

Contents

module ControllerHelpers
  def sign_in(user = instance_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

10 entries across 10 versions & 1 rubygems

Version Path
voyage-1.44.0.14 lib/voyage/templates/controller_helpers.rb
voyage-1.44.0.13 lib/voyage/templates/controller_helpers.rb
voyage-1.44.0.11 lib/voyage/templates/controller_helpers.rb
voyage-1.44.0.12 lib/voyage/templates/controller_helpers.rb
voyage-1.44.0.10 lib/voyage/templates/controller_helpers.rb
voyage-1.44.0.9 lib/voyage/templates/controller_helpers.rb
voyage-1.44.0.8 lib/voyage/templates/controller_helpers.rb
voyage-1.44.0.7 lib/voyage/templates/controller_helpers.rb
voyage-1.44.0.6 lib/voyage/templates/controller_helpers.rb
voyage-1.44.0.5 lib/voyage/templates/controller_helpers.rb