Class: Booth::Test::Userland::Onboardings::Timeout

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::Testing::TimeHelpers, MethodObject, Helpers
Defined in:
lib/booth/test/userland/onboardings/timeout.rb

Instance Method Summary collapse

Methods included from Helpers

#assert_logged_in, #assert_logged_out, #assert_userland_partial, #create_virtual_authenticator, #extract_otp_secret_key_and_generate_code, #setup_virtual_authenticator_environment, #soft_reset_session

Methods included from MethodObject

included

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/booth/test/userland/onboardings/timeout.rb', line 14

def call
  # Setup
  freeze_time

  credential = ::Booth::Models::Credential.create!(
    username: 'alice',
    password: 'qwrasfyxv',
    scope:,
    mode: :username_and_password,
    allowed_modes: %i[username_and_password username_and_webauth]
  )

  onboarding = ::Booth::Models::Onboarding.create!(
    credential_id: credential.id,
    mode: :first_time
  )

  # Onboarding

  travel 7.days - 1.minute

  page.visit show_onboarding_path.sub('ID', onboarding.secret_key)
  assert_userland_partial controller: :onboarding, step: :choose_mode

  travel 2.minutes

  page.visit show_onboarding_path.sub('ID', onboarding.secret_key)
  assert_userland_partial controller: :onboarding, step: :timed_out
end