Sha256: c48ee88adc8fa34e5994708893b53b05465acc17a7b40be03fe0b8455eb14dbe

Contents?: true

Size: 713 Bytes

Versions: 6

Compression:

Stored size: 713 Bytes

Contents

# frozen_string_literal: true
module Omniauth
  module Rails
    module Test
      module RequestHelpers
        # Another option for mocking this, is to use something like this:
        # before do
        #   Rails.application.env_config["omniauth.auth"] = OmniAuth.config.mock_auth[:google_oauth2]
        # end

        def sign_in(email)
          fake_session = {}
          data_store = Omniauth::Rails::AuthenticationDataStore.new(fake_session)
          data_store.set("email", email)
          allow(AuthenticationDataStore).to receive(:new).and_return(data_store)
        end

        def authenticated?
          get "/private"
          response.status == 200
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
omniauth-rails-0.6.0 lib/omniauth/rails/test/request_helpers.rb
omniauth-rails-0.5.0 lib/omniauth/rails/test/request_helpers.rb
omniauth-rails-0.4.0 lib/omniauth/rails/test/request_helpers.rb
omniauth-rails-0.3.0 lib/omniauth/rails/test/request_helpers.rb
omniauth-rails-0.2.0 lib/omniauth/rails/test/request_helpers.rb
omniauth-rails-0.1.0 lib/omniauth/rails/test/request_helpers.rb