Skip to content

refact(api): Adding missing input validations #46

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rashidsp
Copy link
Collaborator

No description provided.

@rashidsp rashidsp assigned oakbani and unassigned oakbani Sep 27, 2018
@rashidsp rashidsp requested a review from oakbani September 27, 2018 14:23
@coveralls
Copy link

coveralls commented Sep 27, 2018

Pull Request Test Coverage Report for Build 438

  • 124 of 124 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 434: 0.0%
Covered Lines: 3097
Relevant Lines: 3097

💛 - Coveralls

Copy link
Collaborator

@oakbani oakbani left a comment

Choose a reason for hiding this comment

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

Looks good.

if logger_valid?(logger) && level
logger.log(level, "#{Optimizely::Helpers::Constants::INPUT_VARIABLES[key.to_s.upcase]} is invalid")
is_valid = false unless value.is_a?(String)
unless key.to_s.upcase == Helpers::Constants::INPUT_VARIABLES.key('User ID')
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not the right way. The method should only do it's own task. It should not know if the incoming thing is a user ID or not. You can keep this method as it is. And for user ids, check string right at the place

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.

3 participants