prefab-cloud-ruby 0.23.4 → 0.23.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/prefab/criteria_evaluator.rb +3 -1
- data/prefab-cloud-ruby.gemspec +3 -3
- data/test/test_criteria_evaluator.rb +37 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24a51f70838a78fdb76b79565fa4c8a28983d95cba2faa486e6bfdd71e095a98
|
4
|
+
data.tar.gz: b559a16d49be776460fe65df55791ff1aa95a2d2a7b655698f9cc434306514ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9365864e53a40214bce51cd9ce0ddc887def06a02a689263d62328964b8344911021363468ec0b5e1bb02568fc07f66ba8f9247cadf8b8215ad1fc628323db9
|
7
|
+
data.tar.gz: 68e93df7c02776894411605d3fbc48d16828bd94d0ae6a7034b713d601916a496a0218b5f76f29f9110661cd2d98a7dc55a3e0118890456e75d80004178b0323
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.23.
|
1
|
+
0.23.5
|
@@ -87,7 +87,9 @@ module Prefab
|
|
87
87
|
|
88
88
|
case criterion_value_or_values
|
89
89
|
when Google::Protobuf::RepeatedField
|
90
|
-
|
90
|
+
# we to_s the value from properties for comparison because the
|
91
|
+
# criterion_value_or_values is a list of strings
|
92
|
+
criterion_value_or_values.include?(value_from_properties.to_s)
|
91
93
|
else
|
92
94
|
criterion_value_or_values == value_from_properties
|
93
95
|
end
|
data/prefab-cloud-ruby.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: prefab-cloud-ruby 0.23.
|
5
|
+
# stub: prefab-cloud-ruby 0.23.5 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "prefab-cloud-ruby".freeze
|
9
|
-
s.version = "0.23.
|
9
|
+
s.version = "0.23.5"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Jeff Dwyer".freeze]
|
14
|
-
s.date = "2023-04-
|
14
|
+
s.date = "2023-04-13"
|
15
15
|
s.description = "Feature Flags, Live Config, and Dynamic Log Levels as a service".freeze
|
16
16
|
s.email = "jdwyer@prefab.cloud".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -505,6 +505,43 @@ class TestCriteriaEvaluator < Minitest::Test
|
|
505
505
|
assert_equal DEFAULT_VALUE, evaluator.evaluate({ email: 'example@gmail.com', admin: true, deleted: true }).string
|
506
506
|
end
|
507
507
|
|
508
|
+
def test_stringifying_property_values_and_names
|
509
|
+
config = Prefab::Config.new(
|
510
|
+
key: KEY,
|
511
|
+
rows: [
|
512
|
+
DEFAULT_ROW,
|
513
|
+
Prefab::ConfigRow.new(
|
514
|
+
project_env_id: PROJECT_ENV_ID,
|
515
|
+
values: [
|
516
|
+
Prefab::ConditionalValue.new(
|
517
|
+
criteria: [
|
518
|
+
Prefab::Criterion.new(
|
519
|
+
operator: Prefab::Criterion::CriterionOperator::PROP_IS_ONE_OF,
|
520
|
+
value_to_match: string_list(%w[1 true hello]),
|
521
|
+
property_name: 'team_name'
|
522
|
+
)
|
523
|
+
],
|
524
|
+
value: Prefab::ConfigValue.new(string: DESIRED_VALUE)
|
525
|
+
)
|
526
|
+
]
|
527
|
+
)
|
528
|
+
]
|
529
|
+
)
|
530
|
+
|
531
|
+
evaluator = Prefab::CriteriaEvaluator.new(config, project_env_id: PROJECT_ENV_ID, resolver: nil,
|
532
|
+
base_client: nil)
|
533
|
+
|
534
|
+
assert_equal DEFAULT_VALUE, evaluator.evaluate({}).string
|
535
|
+
assert_equal DEFAULT_VALUE, evaluator.evaluate({ team_name: 'prefab.cloud' }).string
|
536
|
+
|
537
|
+
[1, true, :hello].each do |value|
|
538
|
+
[:team_name, 'team_name'].each do |property_name|
|
539
|
+
assert_equal DESIRED_VALUE, evaluator.evaluate({ property_name => value }).string
|
540
|
+
assert_equal DESIRED_VALUE, evaluator.evaluate({ property_name => value.to_s }).string
|
541
|
+
end
|
542
|
+
end
|
543
|
+
end
|
544
|
+
|
508
545
|
private
|
509
546
|
|
510
547
|
def string_list(values)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prefab-cloud-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.23.
|
4
|
+
version: 0.23.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Dwyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|