barsoom_utils 0.1.1.24 → 0.1.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ed1d038809af9fe7b26094861cbdabcf978a487d3120555ce866c366d3a5936
4
- data.tar.gz: f1b0db6a18696c991c3d104f405d02431ec0077c3b8b233c36fa59dda63419cd
3
+ metadata.gz: 37307d5bcbef03b5d8906f629cb49014a05378fedf3df4573a22c6af9e7f6c80
4
+ data.tar.gz: 763c544f7580e325fa49acfbaa8d543f4a5556b46a3e730065fbafb8f0cd7a01
5
5
  SHA512:
6
- metadata.gz: eabe607eb0db5a2c154231dcfdcc7d7249d0f26dd97fbc09ed66d396010fa3e3e7894a62f51a4e172f37afd87bbcb8c38f34e091128b8fe2ab88b0e6d077b6c9
7
- data.tar.gz: 958103332532721e0bdce8a3509f3d9c9e2956c033d5f446dc94f8b9011773af455d187b23caef21ae4b603b4fc9aa385f3a9f9a9049a5c7cade1dc988caabb4
6
+ metadata.gz: fac47773c75267940e463f123b77ac3975e1b9abae362a771fc644bf8e3447a3a5253173252f2045c7023a1c3d09cd67404fd2da5af6dda05a004240cfb9b5c4
7
+ data.tar.gz: 5293869f294397c929c87f5cb07716cf83ea12ae489f3a2f13e209eae401358bc70114dd9bee1077e2ab78105f8e0571b812ea58c7776c0fcffee34860c4d11a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1.24
1
+ 0.1.1.27
data/shared_rubocop.yml CHANGED
@@ -265,3 +265,7 @@ Gemspec/OrderedDependencies:
265
265
  # https://docs.rubocop.org/rubocop/cops_gemspec.html#gemspecrequiremfa
266
266
  Gemspec/RequireMFA:
267
267
  Enabled: true
268
+
269
+ # https://docs.rubocop.org/rubocop/cops_naming.html#namingblockforwarding
270
+ Naming/BlockForwarding:
271
+ Enabled: true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barsoom_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.24
4
+ version: 0.1.1.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Skogberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-24 00:00:00.000000000 Z
11
+ date: 2022-08-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -30,14 +30,12 @@ files:
30
30
  - lib/barsoom_utils.rb
31
31
  - lib/barsoom_utils/exception_notifier.rb
32
32
  - lib/barsoom_utils/feature_toggle.rb
33
- - lib/barsoom_utils/parse_space_separated_token_values.rb
34
33
  - lib/barsoom_utils/ping_health_check.rb
35
34
  - lib/barsoom_utils/spec/debug_helpers.rb
36
35
  - lib/barsoom_utils/version.rb
37
36
  - script/test
38
37
  - shared_rubocop.yml
39
38
  - shared_rubocop_rails.yml
40
- - spec/barsoom_utils/parse_space_separated_token_values_spec.rb
41
39
  - spec/exception_notifier_spec.rb
42
40
  - spec/feature_toggle_spec.rb
43
41
  - spec/ping_health_check_spec.rb
@@ -1,30 +0,0 @@
1
- require "attr_extras"
2
-
3
- module BarsoomUtils
4
- class ParseSpaceSeparatedTokenValues
5
- attr_private :minimum_key_size, :value, :token_name
6
-
7
- # @param token_name [String] name of ENV key to look up
8
- # @param minimum_key_size [Integer] required size of each element
9
- # @param data [Hash] defaults to ENV
10
- def initialize(token_name, minimum_key_size:, data: ENV)
11
- @value = data[token_name].to_s
12
- @token_name = token_name
13
- @minimum_key_size = minimum_key_size
14
- end
15
-
16
- def self.call(token_name, minimum_key_size:, data: ENV)
17
- new(token_name, minimum_key_size: minimum_key_size, data: data).call
18
- end
19
-
20
- def call
21
- keys = value.split
22
-
23
- raise "Missing #{token_name}. Quitting." if keys.empty?
24
-
25
- raise "Invalid #{token_name}: a too-short element found. Did a key contain a space? Quitting!" if keys.any? { |api_key| api_key.size < minimum_key_size }
26
-
27
- keys.freeze
28
- end
29
- end
30
- end
@@ -1,39 +0,0 @@
1
- require "barsoom_utils/parse_space_separated_token_values"
2
-
3
- RSpec.describe BarsoomUtils::ParseSpaceSeparatedTokenValues do
4
- let(:minimum_key_size) { 4 }
5
- let(:long_enough_api_key) { "xyza" }
6
- let(:token_name) { "API_TOKENS" }
7
-
8
- subject(:parsed_value) {
9
- described_class.call(token_name, minimum_key_size: minimum_key_size, data: { "API_TOKENS" => api_tokens_value })
10
- }
11
-
12
- context "with a valid set of tokens" do
13
- let(:api_tokens_value) { "#{long_enough_api_key} b#{long_enough_api_key}" }
14
-
15
- it "returns a frozen array" do
16
- expect(parsed_value).to(
17
- be_an(Array)
18
- .and(have_attributes(size: 2))
19
- .and(be_frozen)
20
- )
21
- end
22
- end
23
-
24
- context "with one too-short token" do
25
- let(:api_tokens_value) { "x #{long_enough_api_key}" }
26
-
27
- it "raises an error" do
28
- expect { parsed_value }.to raise_error(/Invalid API_TOKENS/)
29
- end
30
- end
31
-
32
- context "with a blank value" do
33
- let(:api_tokens_value) { " " }
34
-
35
- it "raises an error" do
36
- expect { parsed_value }.to raise_error(/Missing API_TOKENS/)
37
- end
38
- end
39
- end