Navigation Menu

Skip to content
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

Extract private class CookieCredentials #649

Merged
merged 1 commit into from Jan 27, 2019
Merged

Extract private class CookieCredentials #649

merged 1 commit into from Jan 27, 2019

Conversation

jaredbeck
Copy link
Collaborator

  • No change to tests
  • No change to public API
  • In Session::Base, now we can say creds.remember_me_until instead
    of saying creds[2]. This is clearly an improvement.
  • Now we can easily unit-test CookieCredentials.

I think there's also a CookieManager waiting to be extracted ..

- No change to tests
- No change to public API
- In Session::Base, now we can say `creds.remember_me_until` instead
  of saying `creds[2]`. This is clearly an improvement.
- Now we can easily unit-test CookieCredentials.

I think there's also a CookieManager waiting to be extracted ..
@jaredbeck
Copy link
Collaborator Author

This also gives us a natural place to write some better docs about our cookie format. Specifically, it looks like there are at least three variants: 1, 2, and 3 parts. The 2 and 3 part formats can be produced by generate_cookie_for_saving but the 1 part format is a mystery to me. It only happens in session_maintenance_test.rb.

@jaredbeck jaredbeck requested a review from tiegz January 8, 2019 08:50
Copy link
Collaborator

@tiegz tiegz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement!

end

class << self
# @api private
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this method supposed to be private?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ruby-public and api-private. The later (api-private) means that changes to this method will not be considered as breaking.

@record_id.to_s,
@remember_me_until&.iso8601
].compact.join(DELIMITER)
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice 👏

@jaredbeck jaredbeck merged commit b204c8d into master Jan 27, 2019
@jaredbeck jaredbeck deleted the cookie_creds branch January 27, 2019 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants