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

store cookie method #13

Merged
merged 3 commits into from
May 10, 2018
Merged

store cookie method #13

merged 3 commits into from
May 10, 2018

Conversation

patriciojofre
Copy link
Member

This PR adds the missing store cookie method.

@user.store_cookie("your_cookie") if cookies["policy_rule_your_cookie"] == "accepted"

@coveralls
Copy link

coveralls commented May 9, 2018

Pull Request Test Coverage Report for Build 43

  • 1 of 5 (20.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.5%) to 92.723%

Changes Missing Coverage Covered Lines Changed/Added Lines %
app/models/policy_manager/concerns/user_behavior.rb 1 5 20.0%
Totals Coverage Status
Change from base Build 37: -0.5%
Covered Lines: 739
Relevant Lines: 797

💛 - Coveralls

@@ -130,4 +130,12 @@ def can_request_portability?
self.portability_requests.select{|p| p.pending? || p.progress?}.blank?
end

def store_cookie(name)
Copy link
Contributor

Choose a reason for hiding this comment

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

@patriciojofre why call it store_cookie if it can apply to any rule ?
We could have a store_policy_RULE_NAME for every rule initialized in the user concern for example
What do you think ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with the method naming, however I think we could avoid creating multiple methods and just just add the store_policy_from(name).
This is just a method that wraps the "current_user.handle_policy_for(@term)" with an extra logic were validates the presence of a published term.

Copy link
Contributor

Choose a reason for hiding this comment

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

since the method accepts a term, we should name it as accept_policy_from

Copy link
Member Author

Choose a reason for hiding this comment

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

+1 @michelson, create multiples methods for this little wrapper is not necessary.
I'll change the name to accept_policy_from 😄

@patriciojofre patriciojofre merged commit 32ffc94 into master May 10, 2018
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.

4 participants