Sha256: 968d9cf028098ee35bf480f114838f362ba0295d7f6ec40b939c70ad4de8027b

Contents?: true

Size: 734 Bytes

Versions: 8

Compression:

Stored size: 734 Bytes

Contents

module UserFeatureMethods
  def stub_g5_omniauth(user, options={})
    OmniAuth.config.mock_auth[:g5] = OmniAuth::AuthHash.new({
      uid: user.uid,
      provider: 'g5',
      info: {email: user.email},
      credentials: {token: user.g5_access_token}
    }.merge(options))
  end

  def stub_g5_invalid_credentials
    OmniAuth.config.mock_auth[:g5] = :invalid_credentials
  end

  def visit_path_and_login_with(path, user)
    stub_g5_omniauth(user)
    visit path
  end
end

RSpec.configure do |config|
  config.before(:each) do
    OmniAuth.config.test_mode = true
    OmniAuth.config.mock_auth[:g5] = nil
  end
  config.after(:each) { OmniAuth.config.test_mode = false }

  config.include UserFeatureMethods, type: :feature
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
devise_g5_authenticatable-0.3.0 spec/support/user_feature_methods.rb
devise_g5_authenticatable-0.2.5.beta spec/support/user_feature_methods.rb
devise_g5_authenticatable-0.2.4 spec/support/user_feature_methods.rb
devise_g5_authenticatable-0.2.4.beta spec/support/user_feature_methods.rb
devise_g5_authenticatable-0.2.3 spec/support/user_feature_methods.rb
devise_g5_authenticatable-0.2.2 spec/support/user_feature_methods.rb
devise_g5_authenticatable-0.2.1 spec/support/user_feature_methods.rb
devise_g5_authenticatable-0.2.0 spec/support/user_feature_methods.rb