Skip to content

Commit 582c3bb

Browse files
committed
💚 Improved test
1 parent 5069fa9 commit 582c3bb

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.rubocop_gradual.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
[78, 3, 30, "Gemspec/DependencyVersion: Dependency version specification is required.", 2010339150],
2727
[89, 3, 72, "Gemspec/DependencyVersion: Dependency version specification is required.", 2491072344]
2828
],
29-
"test/test_helper.rb:4156984416": [
30-
[208, 45, 1, "Lint/AssignmentInCondition: Wrap assignment in parentheses if intentional", 177560]
29+
"test/test_helper.rb:2039320549": [
30+
[206, 45, 1, "Lint/AssignmentInCondition: Wrap assignment in parentheses if intentional", 177560]
3131
]
3232
}

test/functional/masq/sessions_controller_test.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,20 @@ def test_should_set_authentication_attributes_after_successful_login
120120

121121
def test_should_authenticate_with_password_and_yubico_otp
122122
@account = accounts(:with_yubico_identity)
123+
assert_nil(@account.last_authenticated_at)
124+
assert(!@account.last_authenticated_by_yubikey)
125+
assert(@account.login == "yubikey")
126+
return_to = "/super-duper"
127+
original_return_to = session[:return_to]
128+
session[:return_to] = return_to
123129
yubico_otp = @account.yubico_identity + "x" * 32
124-
Account.expects(:verify_yubico_otp).with(yubico_otp).returns(true)
130+
Masq::Account.expects(:verify_yubico_otp).with(yubico_otp).returns(true)
125131
post(:create, params: {login: @account.login, password: "test" + yubico_otp})
132+
session[:return_to] = original_return_to # Don't bleed state, even if the login failed.
133+
assert_redirected_to(return_to)
126134
# TODO: Why does the account save seems to be very slow sometimes?
127135
# Or is it failing to save the account randomly?
128-
sleep(1)
136+
sleep(2)
129137
@account.reload
130138
assert_not_nil(@account.last_authenticated_at)
131139
assert(@account.last_authenticated_by_yubikey)

0 commit comments

Comments
 (0)