-
Notifications
You must be signed in to change notification settings - Fork 15
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
Cast boolean values #45
base: master
Are you sure you want to change the base?
Conversation
`rspec/core` is loaded by default.
require 'rubygems' | ||
require 'bundler' | ||
|
||
Bundler.require |
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.
https://bundler.io/guides/bundler_setup.html
For such a small Gemfile, we’d advise you to skip Bundler.require and just require the gems by hand
@@ -1,12 +1,7 @@ | |||
# frozen_string_literal: true | |||
|
|||
require 'rubygems' | |||
require 'bundler' |
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.
Did not find why these were needed.
@@ -95,7 +95,7 @@ def load_parameters_from_ssm(next_token = nil) | |||
def build_configuration_from_parameters(parameters) | |||
configuration = {} | |||
parameters.each do |parameter| | |||
parameter_parts = parameter.name[@prefix.length..-1].split(PATH_SEPARATOR).map(&:to_sym) | |||
parameter_parts = parameter.name[@prefix.length..].split(PATH_SEPARATOR).map(&:to_sym) |
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.
rubocop autofix. applies to other as well.
'off', :off, | ||
'OFF', :OFF | ||
].to_set.freeze | ||
private_constant :FALSE_VALUES |
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.
FALSE_VALUES
is implementation details and should not be exposed.
normalized_method = normalize_key_by_method(method) | ||
if key?(normalized_method) | ||
value = get_configuration_value(normalized_method) | ||
boolean_method?(method) ? cast_boolean(value) : value |
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.
this is what this PR is all about.
require 'aws-sdk-ssm' | ||
require 'global/backend/aws_parameter_store' | ||
|
||
RSpec.describe Global::Backend::AwsParameterStore do | ||
subject(:parameter_store) do | ||
described_class.new(prefix: '/testapp/', client: client) | ||
end |
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.
fixed rubocop abuses. applies to other spec files.
@@ -1,9 +1,5 @@ | |||
# frozen_string_literal: true | |||
|
|||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) | |||
$LOAD_PATH.unshift(File.dirname(__FILE__)) |
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.
spec
and lib
directories are in the load path by default
@@ -1,9 +1,5 @@ | |||
# frozen_string_literal: true | |||
|
|||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) | |||
$LOAD_PATH.unshift(File.dirname(__FILE__)) | |||
require 'rspec' |
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.
rspec/core
is loaded by default
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) | ||
$LOAD_PATH.unshift(File.dirname(__FILE__)) | ||
require 'rspec' | ||
require 'global' |
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.
simplecov
should be required before any code is loaded
https://github.com/simplecov-ruby/simplecov?tab=readme-ov-file#troubleshooting
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.
I suppose the ruby version range is acceptable, seeing as 3.0 is already EOL
- 3.3 | ||
- 3.2 | ||
- 3.1 | ||
- 3.0 |
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.
Boolean methods return raw values. AWS Parameters Store does not support boolean type.
In this PR I attempted to address this problem: