-
Notifications
You must be signed in to change notification settings - Fork 167
LG-13132 Adds property to SP redirect initiated event #10560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
91b6c23
changelog: Internal, Analytics, Adds property to SP redirect initiate…
kevinsmaster5 78d633a
update controllers to account for legit nil values at login page visi…
kevinsmaster5 40e1d2d
change to duration tracking to allow for nil. fix redundant integer m…
kevinsmaster5 fad7f29
remove hard-coded nil value
kevinsmaster5 d04598b
rebase merge conflict. fix mis-inserted function in auth count concer…
kevinsmaster5 75e24c0
wrap time-based expect blocks in freeze_time. at least one spec was f…
kevinsmaster5 2eefd38
reframe freeze block
kevinsmaster5 9d73e1a
add travel to expected time elapsed
kevinsmaster5 05daf88
add freeze and travel to to test
kevinsmaster5 d04e5c6
correct use of freeze_time and add travel to to tests
kevinsmaster5 6b77d11
put better control over time in idp controller test
kevinsmaster5 82fe600
tracking saml_idp as nil seems more appropriate with the tests there.…
kevinsmaster5 215a270
move sign_in_duration method to its own concern
kevinsmaster5 9b2cfa8
rename duration method, leverage around -> do for better freeze_time …
kevinsmaster5 211eb57
add unit test for SignInDurationConcern
kevinsmaster5 8d6da7b
improve concern spec with time freeze and clarify test context
kevinsmaster5 bd83f17
make use of time as string consistent
kevinsmaster5 38f2264
remove leftover code comments
kevinsmaster5 f2d38b2
adjust time freeze
kevinsmaster5 0cff096
create more precision by rounding instead of converting to i
kevinsmaster5 d7cbaa1
change sign in duration output to a floating number
kevinsmaster5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module SignInDurationConcern | ||
| extend ActiveSupport::Concern | ||
|
|
||
| def sign_in_duration_seconds | ||
| return unless session[:sign_in_page_visited_at] | ||
| (Time.zone.now - Time.zone.parse(session[:sign_in_page_visited_at])).seconds.to_f | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
spec/controllers/concerns/sign_in_duration_concern_spec.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| require 'rails_helper' | ||
|
|
||
| RSpec.describe SignInDurationConcern, type: :controller do | ||
| let(:test_class) do | ||
| Class.new do | ||
| include SignInDurationConcern | ||
|
|
||
| attr_reader :session | ||
|
|
||
| def initialize(session = {}) | ||
| @session = session | ||
| end | ||
| end | ||
| end | ||
|
|
||
| let(:instance) { test_class.new } | ||
|
|
||
| describe '#sign_in_duration_seconds' do | ||
| let(:sign_in_page_visited_at) {} | ||
| around do |example| | ||
| freeze_time { example.run } | ||
| end | ||
|
|
||
| before do | ||
| instance.session[:sign_in_page_visited_at] = sign_in_page_visited_at | ||
| end | ||
|
|
||
| context 'when session value is assigned' do | ||
| let(:sign_in_page_visited_at) { 6.seconds.ago.to_s } | ||
| it 'returns seconds since value' do | ||
| expect(instance.sign_in_duration_seconds).to eq(6) | ||
| end | ||
| end | ||
|
|
||
| context 'when session value is not assigned' do | ||
| let(:sign_in_page_visited_at) { nil } | ||
| it 'returns nil' do | ||
| expect(instance.sign_in_duration_seconds).to be_nil | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a
spec/controllers/concerns/sign_in_duration_concern_spec.rbwith test coverage?