Sha256: 257fd0e60fd40ae47b84c6e9efbf707ee0fc30641c31600db7f216ed27f69195

Contents?: true

Size: 755 Bytes

Versions: 26

Compression:

Stored size: 755 Bytes

Contents

module FeatureHelpers
  def in_browser(name)
    original_browser = Capybara.session_name
    Capybara.session_name = name
    yield
    Capybara.session_name = original_browser
  end

  def sign_in(options = {})
    visit login_path
    fill_in 'username', with: options[:username] || 'testuser'
    fill_in 'password', with: options[:password] || 'foobar123'
    click_button 'Login'
  end

  def enable_two_factor_authentication
    visit new_two_factor_authenticator_path
    secret = find('p#secret').text.gsub(/^Secret:\s*/, '')
    ROTP::TOTP.new(secret).tap do |totp|
      fill_in 'otp', with: "#{totp.now}"
      click_button 'Verify and enable'
    end
  end
end

RSpec.configure do |config|
  config.include FeatureHelpers, type: :feature
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
casino-4.1.2 spec/support/features_helper.rb
casino-4.1.1 spec/support/features_helper.rb
casino-4.1.0 spec/support/features_helper.rb
casino-4.0.3 spec/support/features_helper.rb
casino-4.0.2 spec/support/features_helper.rb
casino-4.0.1 spec/support/features_helper.rb
casino-4.0.0 spec/support/features_helper.rb
casino-4.0.0.pre.2 spec/support/features_helper.rb
casino-4.0.0.pre.1 spec/support/features_helper.rb
casino-3.0.4 spec/support/features_helper.rb
casino-2.0.7 spec/support/features_helper.rb
casino-3.0.3 spec/support/features_helper.rb
casino-3.0.2 spec/support/features_helper.rb
casino-3.0.1 spec/support/features_helper.rb
casino-3.0.0 spec/support/features_helper.rb
casino-3.0.0.pre.2 spec/support/features_helper.rb
casino-3.0.0.pre.1 spec/support/features_helper.rb
casino-2.0.6 spec/support/features_helper.rb
casino-2.0.5 spec/support/features_helper.rb
casino-2.0.4 spec/support/features_helper.rb