Sha256: 05017e817c6261f95528b60cd3f8375b0579ff618761ceb8e9ee7bce3da5e2c9

Contents?: true

Size: 906 Bytes

Versions: 22

Compression:

Stored size: 906 Bytes

Contents

module FeatureSignInHelper
  def sign_in(user = create(:user))
    mock_omni_auth_google_oauth2(
      uid: user.uid,
      name: user.name,
      first_name: user.first_name,
      last_name: user.last_name,
      email: user.email,
      image: user.image,
    )

    visit kuroko2_path
    click_on('Sign in with Google')
  end

  def mock_omni_auth_google_oauth2(options = {})
    OmniAuth.config.mock_auth[:google_oauth2] = OmniAuth::AuthHash.new(
      uid: options[:uid] || 'john@example.org',
      info: {
        name: options[:name] || "John Doe",
        first_name: options[:first_name] || "John",
        last_name: options[:last_name] || "Doe",
        email: options[:email] || "john@example.org",
        image: options[:image] || "https://img.example.org/john.doe.png",
      },
      credentials: {
        expires_at: options[:expires_at] || 1.month.since.to_i,
      }
    )
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
kuroko2-0.8.0 spec/support/feature_sign_in_helper.rb
kuroko2-0.7.0 spec/support/feature_sign_in_helper.rb
kuroko2-0.6.0 spec/support/feature_sign_in_helper.rb
kuroko2-0.5.2 spec/support/feature_sign_in_helper.rb
kuroko2-0.5.1 spec/support/feature_sign_in_helper.rb
kuroko2-0.5.0 spec/support/feature_sign_in_helper.rb
kuroko2-0.4.6 spec/support/feature_sign_in_helper.rb
kuroko2-0.4.5 spec/support/feature_sign_in_helper.rb
kuroko2-0.4.4 spec/support/feature_sign_in_helper.rb
kuroko2-0.4.3 spec/support/feature_sign_in_helper.rb
kuroko2-0.4.2 spec/support/feature_sign_in_helper.rb
kuroko2-0.4.1 spec/support/feature_sign_in_helper.rb
kuroko2-0.4.0 spec/support/feature_sign_in_helper.rb
kuroko2-0.3.4 spec/support/feature_sign_in_helper.rb
kuroko2-0.3.3 spec/support/feature_sign_in_helper.rb
kuroko2-0.3.2 spec/support/feature_sign_in_helper.rb
kuroko2-0.3.1 spec/support/feature_sign_in_helper.rb
kuroko2-0.3.0 spec/support/feature_sign_in_helper.rb
kuroko2-0.2.3 spec/support/feature_sign_in_helper.rb
kuroko2-0.2.2 spec/support/feature_sign_in_helper.rb