Skip to content

Commit

Permalink
Increase time range for authentication spec (#932)
Browse files Browse the repository at this point in the history
In commit ce17d2d some specs were added
to verify that the time it takes to authenticate users that already
exist and those that don't is within 0.001s. This causes the tests to
fail randomly given that the time range is too precise. We are
increasing this range to 0.01 to avoid flaky tests.
  • Loading branch information
MottiniMauro authored Feb 26, 2021
1 parent eeb5b0f commit 6e66881
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
User.authenticate("[email protected]", password)
end

expect(user_does_not_exist_time). to be_within(0.001).of(user_exists_time)
expect(user_does_not_exist_time). to be_within(0.01).of(user_exists_time)
end

it "takes the same amount of time to fail authentication regardless of whether user exists" do
Expand All @@ -73,7 +73,7 @@
User.authenticate("[email protected]", "bad_password")
end

expect(user_does_not_exist_time). to be_within(0.001).of(user_exists_time)
expect(user_does_not_exist_time). to be_within(0.01).of(user_exists_time)
end

it "is retrieved via a case-insensitive search" do
Expand Down

0 comments on commit 6e66881

Please sign in to comment.