quonfig 0.0.9 → 0.0.11

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.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -0
  3. data/README.md +4 -4
  4. data/lib/quonfig/evaluation_details.rb +60 -0
  5. data/lib/quonfig/options.rb +37 -16
  6. data/lib/quonfig/sse_config_client.rb +1 -1
  7. data/lib/quonfig/version.rb +5 -0
  8. data/lib/quonfig.rb +2 -1
  9. data/quonfig.gemspec +30 -163
  10. metadata +29 -182
  11. data/.claude/rules/constitution.md +0 -81
  12. data/.claude/rules/git-safety.md +0 -11
  13. data/.claude/rules/issue-tracking.md +0 -13
  14. data/.claude/rules/testing-workflow.md +0 -28
  15. data/.envrc.sample +0 -3
  16. data/.github/CODEOWNERS +0 -2
  17. data/.github/pull_request_template.md +0 -8
  18. data/.github/workflows/release.yml +0 -49
  19. data/.github/workflows/ruby.yml +0 -60
  20. data/.github/workflows/test.yaml +0 -40
  21. data/.rubocop.yml +0 -13
  22. data/.tool-versions +0 -1
  23. data/CLAUDE.md +0 -29
  24. data/CODEOWNERS +0 -1
  25. data/Gemfile +0 -26
  26. data/Gemfile.lock +0 -177
  27. data/Rakefile +0 -64
  28. data/VERSION +0 -1
  29. data/dev/allocation_stats +0 -60
  30. data/dev/benchmark +0 -40
  31. data/dev/console +0 -12
  32. data/dev/script_setup.rb +0 -18
  33. data/test/fixtures/datafile.json +0 -87
  34. data/test/integration/test_context_precedence.rb +0 -112
  35. data/test/integration/test_datadir_environment.rb +0 -54
  36. data/test/integration/test_dev_overrides.rb +0 -40
  37. data/test/integration/test_enabled.rb +0 -478
  38. data/test/integration/test_enabled_with_contexts.rb +0 -64
  39. data/test/integration/test_get.rb +0 -136
  40. data/test/integration/test_get_feature_flag.rb +0 -28
  41. data/test/integration/test_get_or_raise.rb +0 -60
  42. data/test/integration/test_get_weighted_values.rb +0 -34
  43. data/test/integration/test_helpers.rb +0 -667
  44. data/test/integration/test_helpers_test.rb +0 -73
  45. data/test/integration/test_post.rb +0 -44
  46. data/test/integration/test_telemetry.rb +0 -170
  47. data/test/support/common_helpers.rb +0 -106
  48. data/test/support/mock_base_client.rb +0 -27
  49. data/test/support/mock_config_loader.rb +0 -1
  50. data/test/test_bound_client.rb +0 -109
  51. data/test/test_caching_http_connection.rb +0 -218
  52. data/test/test_client.rb +0 -255
  53. data/test/test_client_network_mode.rb +0 -136
  54. data/test/test_client_telemetry.rb +0 -175
  55. data/test/test_config_loader.rb +0 -70
  56. data/test/test_context.rb +0 -139
  57. data/test/test_context_shape.rb +0 -37
  58. data/test/test_context_shape_aggregator.rb +0 -126
  59. data/test/test_datadir.rb +0 -203
  60. data/test/test_dev_context.rb +0 -163
  61. data/test/test_duration.rb +0 -37
  62. data/test/test_encryption.rb +0 -16
  63. data/test/test_evaluation_summaries_aggregator.rb +0 -180
  64. data/test/test_evaluator.rb +0 -285
  65. data/test/test_example_contexts_aggregator.rb +0 -119
  66. data/test/test_exponential_backoff.rb +0 -44
  67. data/test/test_fixed_size_hash.rb +0 -119
  68. data/test/test_helper.rb +0 -17
  69. data/test/test_http_connection.rb +0 -79
  70. data/test/test_internal_logger.rb +0 -34
  71. data/test/test_options.rb +0 -167
  72. data/test/test_rate_limit_cache.rb +0 -44
  73. data/test/test_reason.rb +0 -79
  74. data/test/test_rename.rb +0 -65
  75. data/test/test_resolver.rb +0 -291
  76. data/test/test_semantic_logger_filter.rb +0 -144
  77. data/test/test_semver.rb +0 -108
  78. data/test/test_should_log.rb +0 -186
  79. data/test/test_sse_config_client.rb +0 -297
  80. data/test/test_stdlib_formatter.rb +0 -195
  81. data/test/test_telemetry_reporter.rb +0 -209
  82. data/test/test_typed_getters.rb +0 -131
  83. data/test/test_types.rb +0 -141
  84. data/test/test_weighted_value_resolver.rb +0 -84
data/Gemfile.lock DELETED
@@ -1,177 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- activesupport (7.1.3.2)
5
- base64
6
- bigdecimal
7
- concurrent-ruby (~> 1.0, >= 1.0.2)
8
- connection_pool (>= 2.2.5)
9
- drb
10
- i18n (>= 1.6, < 2)
11
- minitest (>= 5.1)
12
- mutex_m
13
- tzinfo (~> 2.0)
14
- addressable (2.8.6)
15
- public_suffix (>= 2.0.2, < 6.0)
16
- allocation_stats (0.1.5)
17
- ansi (1.5.0)
18
- base64 (0.2.0)
19
- benchmark-ips (2.13.0)
20
- bigdecimal (3.1.7)
21
- builder (3.2.4)
22
- concurrent-ruby (1.2.3)
23
- connection_pool (2.4.1)
24
- descendants_tracker (0.0.4)
25
- thread_safe (~> 0.3, >= 0.3.1)
26
- docile (1.4.0)
27
- domain_name (0.6.20240107)
28
- drb (2.2.1)
29
- faraday (1.10.3)
30
- faraday-em_http (~> 1.0)
31
- faraday-em_synchrony (~> 1.0)
32
- faraday-excon (~> 1.1)
33
- faraday-httpclient (~> 1.0)
34
- faraday-multipart (~> 1.0)
35
- faraday-net_http (~> 1.0)
36
- faraday-net_http_persistent (~> 1.0)
37
- faraday-patron (~> 1.0)
38
- faraday-rack (~> 1.0)
39
- faraday-retry (~> 1.0)
40
- ruby2_keywords (>= 0.0.4)
41
- faraday-em_http (1.0.0)
42
- faraday-em_synchrony (1.0.0)
43
- faraday-excon (1.1.0)
44
- faraday-httpclient (1.0.1)
45
- faraday-multipart (1.0.4)
46
- multipart-post (~> 2)
47
- faraday-net_http (1.0.1)
48
- faraday-net_http_persistent (1.2.0)
49
- faraday-patron (1.0.0)
50
- faraday-rack (1.0.0)
51
- faraday-retry (1.0.3)
52
- ffi (1.17.4)
53
- ffi-compiler (1.3.2)
54
- ffi (>= 1.15.5)
55
- rake
56
- git (1.19.1)
57
- addressable (~> 2.8)
58
- rchardet (~> 1.8)
59
- github_api (0.19.0)
60
- addressable (~> 2.4)
61
- descendants_tracker (~> 0.0.4)
62
- faraday (>= 0.8, < 2)
63
- hashie (~> 3.5, >= 3.5.2)
64
- oauth2 (~> 1.0)
65
- hashie (3.6.0)
66
- highline (3.0.1)
67
- http (5.2.0)
68
- addressable (~> 2.8)
69
- base64 (~> 0.1)
70
- http-cookie (~> 1.0)
71
- http-form_data (~> 2.2)
72
- llhttp-ffi (~> 0.5.0)
73
- http-cookie (1.0.5)
74
- domain_name (~> 0.5)
75
- http-form_data (2.3.0)
76
- i18n (1.14.4)
77
- concurrent-ruby (~> 1.0)
78
- juwelier (2.4.9)
79
- builder
80
- bundler
81
- git
82
- github_api
83
- highline
84
- kamelcase (~> 0)
85
- nokogiri
86
- psych
87
- rake
88
- rdoc
89
- semver2
90
- jwt (2.8.1)
91
- base64
92
- kamelcase (0.0.2)
93
- semver2 (~> 3)
94
- ld-eventsource (2.2.2)
95
- concurrent-ruby (~> 1.0)
96
- http (>= 4.4.1, < 6.0.0)
97
- llhttp-ffi (0.5.0)
98
- ffi-compiler (~> 1.0)
99
- rake (~> 13.0)
100
- macaddr (1.7.2)
101
- systemu (~> 2.6.5)
102
- mini_portile2 (2.8.9)
103
- minitest (5.22.3)
104
- minitest-focus (1.4.0)
105
- minitest (>= 4, < 6)
106
- minitest-reporters (1.6.1)
107
- ansi
108
- builder
109
- minitest (>= 5.0)
110
- ruby-progressbar
111
- multi_json (1.15.0)
112
- multi_xml (0.6.0)
113
- multipart-post (2.4.0)
114
- mutex_m (0.2.0)
115
- nokogiri (1.18.9)
116
- mini_portile2 (~> 2.8.2)
117
- racc (~> 1.4)
118
- oauth2 (1.4.11)
119
- faraday (>= 0.17.3, < 3.0)
120
- jwt (>= 1.0, < 3.0)
121
- multi_json (~> 1.3)
122
- multi_xml (~> 0.5)
123
- rack (>= 1.2, < 4)
124
- psych (5.1.2)
125
- stringio
126
- public_suffix (5.0.4)
127
- racc (1.8.1)
128
- rack (3.1.18)
129
- rake (13.1.0)
130
- rchardet (1.8.0)
131
- rdoc (6.6.3.1)
132
- psych (>= 4.0.0)
133
- ruby-progressbar (1.13.0)
134
- ruby2_keywords (0.0.5)
135
- semantic_logger (4.15.0)
136
- concurrent-ruby (~> 1.0)
137
- semver2 (3.4.2)
138
- simplecov (0.22.0)
139
- docile (~> 1.1)
140
- simplecov-html (~> 0.11)
141
- simplecov_json_formatter (~> 0.1)
142
- simplecov-html (0.12.3)
143
- simplecov_json_formatter (0.1.4)
144
- stringio (3.1.0)
145
- systemu (2.6.5)
146
- thread_safe (0.3.6)
147
- timecop (0.9.8)
148
- tzinfo (2.0.6)
149
- concurrent-ruby (~> 1.0)
150
- uuid (2.3.9)
151
- macaddr (~> 1.0)
152
- webrick (1.8.2)
153
-
154
- PLATFORMS
155
- ruby
156
-
157
- DEPENDENCIES
158
- activesupport (>= 4)
159
- allocation_stats
160
- benchmark-ips
161
- bundler
162
- concurrent-ruby (~> 1.0, >= 1.0.5)
163
- faraday
164
- juwelier (~> 2.4.9)
165
- ld-eventsource
166
- minitest
167
- minitest-focus
168
- minitest-reporters
169
- rdoc
170
- semantic_logger (!= 4.16.0)
171
- simplecov
172
- timecop
173
- uuid
174
- webrick
175
-
176
- BUNDLED WITH
177
- 2.3.5
data/Rakefile DELETED
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rubygems'
4
- require 'bundler'
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- warn e.message
9
- warn 'Run `bundle install` to install missing gems'
10
- exit e.status_code
11
- end
12
-
13
- require 'rake'
14
-
15
- require 'rake/testtask'
16
- Rake::TestTask.new(:test) do |test|
17
- test.libs << 'lib' << 'test'
18
- test.pattern = 'test/**/test_*.rb'
19
- test.verbose = true
20
- end
21
-
22
- task default: :test
23
-
24
- unless ENV['CI']
25
- require 'juwelier'
26
- Juwelier::Tasks.new do |gem|
27
- # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
28
- gem.name = 'quonfig'
29
- gem.homepage = 'https://github.com/quonfig/sdk-ruby'
30
- gem.license = 'MIT'
31
- gem.summary = %(Quonfig Ruby SDK)
32
- gem.description = %(Quonfig — feature flags and live config, stored as files in git.)
33
- gem.email = 'jeff@quonfig.com'
34
- gem.authors = ['Jeff Dwyer']
35
-
36
- # dependencies defined in Gemfile
37
- end
38
- Juwelier::RubygemsDotOrgTasks.new
39
-
40
- desc 'Code coverage detail'
41
- task :simplecov do
42
- ENV['COVERAGE'] = 'true'
43
- Rake::Task['test'].execute
44
- end
45
-
46
- require 'rdoc/task'
47
- Rake::RDocTask.new do |rdoc|
48
- version = File.exist?('VERSION') ? File.read('VERSION') : ''
49
-
50
- rdoc.rdoc_dir = 'rdoc'
51
- rdoc.title = "quonfig #{version}"
52
- rdoc.rdoc_files.include('README*')
53
- rdoc.rdoc_files.include('lib/**/*.rb')
54
- end
55
- end
56
-
57
- # Add release task for CI
58
- task :release do
59
- sh 'mkdir -p pkg'
60
- version = File.read('VERSION').strip
61
- gem_file = "pkg/quonfig-#{version}.gem"
62
- sh "gem build quonfig.gemspec --output #{gem_file}"
63
- sh "gem push #{gem_file}"
64
- end
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.9
data/dev/allocation_stats DELETED
@@ -1,60 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
-
6
- gemspec = Dir.glob(File.expand_path("../../*.gemspec", __FILE__)).first
7
- spec = Gem::Specification.load(gemspec)
8
-
9
- # Add the require paths to the $LOAD_PATH
10
- spec.require_paths.each do |path|
11
- full_path = File.expand_path("../" + path, __dir__)
12
- $LOAD_PATH.unshift(full_path) unless $LOAD_PATH.include?(full_path)
13
- end
14
-
15
- spec.require_paths.each do |path|
16
- require "./lib/reforge-sdk"
17
- end
18
-
19
- require 'reforge-sdk'
20
-
21
- $prefab = Reforge::Client.new(collect_logger_counts: false, collect_evaluation_summaries: false,
22
- context_upload_mode: :none)
23
- $prefab.get('a.live.integer')
24
-
25
- puts '-' * 80
26
-
27
- require 'allocation_stats'
28
-
29
- $runs = 100
30
-
31
- def measure(description)
32
- puts "Measuring #{description}..."
33
- stats = $prefab.with_context(user: { email_suffix: 'yahoo.com' }) do
34
- AllocationStats.trace do
35
- $runs.times do
36
- yield
37
- end
38
- end
39
- end
40
-
41
- allocations = stats.allocations(alias_paths: true).group_by(:sourcefile, :sourceline, :class)
42
-
43
- if ENV['TOP']
44
- puts allocations.sort_by_size.to_text.split("\n").first(20)
45
- end
46
-
47
- puts "Total allocations: #{allocations.all.values.map(&:size).sum}"
48
- puts "Total memory: #{allocations.all.values.flatten.map(&:memsize).sum}"
49
- puts stats.gc_profiler_report
50
- end
51
-
52
- measure "no-JIT context (#{$runs} runs)" do
53
- $prefab.get('a.live.integer')
54
- end
55
-
56
- puts "\n\n"
57
-
58
- measure "with JIT context (#{$runs} runs)" do
59
- $prefab.get('a.live.integer', { a: { b: "c" } })
60
- end
data/dev/benchmark DELETED
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
-
6
- gemspec = Dir.glob(File.expand_path("../../*.gemspec", __FILE__)).first
7
- spec = Gem::Specification.load(gemspec)
8
-
9
- # Add the require paths to the $LOAD_PATH
10
- spec.require_paths.each do |path|
11
- full_path = File.expand_path("../" + path, __dir__)
12
- $LOAD_PATH.unshift(full_path) unless $LOAD_PATH.include?(full_path)
13
- end
14
-
15
- spec.require_paths.each do |path|
16
- require "./lib/reforge-sdk"
17
- end
18
-
19
- require 'reforge-sdk'
20
- require 'benchmark/ips'
21
-
22
- prefab = Reforge::Client.new(collect_logger_counts: false, collect_evaluation_summaries: false,
23
- context_upload_mode: :none)
24
-
25
- prefab.get('prefab.auth.allowed_origins')
26
-
27
- prefab.with_context(user: { email_suffix: 'yahoo.com' }) do
28
- Benchmark.ips do |x|
29
- x.report("noop") do
30
- end
31
-
32
- x.report('prefab.get') do
33
- prefab.get('prefab.auth.allowed_origins')
34
- end
35
-
36
- x.report('prefab.get with jit context') do
37
- prefab.get('prefab.auth.allowed_origins', { a: { b: "c" } })
38
- end
39
- end
40
- end
data/dev/console DELETED
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env bundle exec ruby
2
- # frozen_string_literal: true
3
-
4
- require 'irb'
5
- require_relative "./script_setup"
6
-
7
- if !ENV['REFORGE_LOG_CLIENT_BOOTSTRAP_LOG_LEVEL']
8
- puts "run with REFORGE_LOG_CLIENT_BOOTSTRAP_LOG_LEVEL=debug (or trace) for more output"
9
- end
10
-
11
- # Start an IRB session
12
- IRB.start(__FILE__)
data/dev/script_setup.rb DELETED
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/setup'
4
-
5
- gemspec = Dir.glob(File.expand_path("../../*.gemspec", __FILE__)).first
6
- spec = Gem::Specification.load(gemspec)
7
-
8
- # Add the require paths to the $LOAD_PATH
9
- spec.require_paths.each do |path|
10
- full_path = File.expand_path("../" + path, __dir__)
11
- $LOAD_PATH.unshift(full_path) unless $LOAD_PATH.include?(full_path)
12
- end
13
-
14
- spec.require_paths.each do |path|
15
- require "./lib/quonfig"
16
- end
17
-
18
- SemanticLogger.add_appender(io: $stdout)
@@ -1,87 +0,0 @@
1
- {
2
- "configs": [
3
- {
4
- "id": "16825372746571694",
5
- "projectId": "202",
6
- "key": "log-level",
7
- "changedBy": {
8
- "email": "jeffrey.chupp@prefab.cloud"
9
- },
10
- "configType": "DELETED"
11
- },
12
- {
13
- "id": "17271108409487302",
14
- "projectId": "202",
15
- "key": "flag.list.environments",
16
- "changedBy": {
17
- "email": "jeffrey.chupp@prefab.cloud"
18
- },
19
- "rows": [
20
- {
21
- "projectEnvId": "308",
22
- "values": [
23
- {
24
- "criteria": [
25
- {
26
- "propertyName": "user.key",
27
- "operator": "PROP_IS_ONE_OF",
28
- "valueToMatch": {
29
- "stringList": {
30
- "values": [
31
- "5905ecd1-9bbf-4711-a663-4f713628a78c"
32
- ]
33
- }
34
- }
35
- }
36
- ],
37
- "value": {
38
- "bool": true
39
- }
40
- },
41
- {
42
- "value": {
43
- "bool": true
44
- }
45
- }
46
- ]
47
- }
48
- ],
49
- "allowableValues": [
50
- {
51
- "bool": false
52
- },
53
- {
54
- "bool": true
55
- }
56
- ],
57
- "configType": "FEATURE_FLAG",
58
- "valueType": "BOOL"
59
- },
60
- {
61
- "id": "17271831941669987",
62
- "projectId": "202",
63
- "key": "my.test.string",
64
- "changedBy": {
65
- "userId": "3",
66
- "apiKeyId": "481"
67
- },
68
- "rows": [
69
- {
70
- "values": [
71
- {
72
- "value": {
73
- "string": "hello world"
74
- }
75
- }
76
- ]
77
- }
78
- ],
79
- "configType": "CONFIG",
80
- "valueType": "STRING"
81
- }
82
- ],
83
- "configServicePointer": {
84
- "projectId": "202",
85
- "projectEnvId": "308"
86
- }
87
- }
@@ -1,112 +0,0 @@
1
- # frozen_string_literal: true
2
- #
3
- # AUTO-GENERATED from integration-test-data/tests/eval/context_precedence.yaml.
4
- # Regenerate with:
5
- # cd integration-test-data/generators && npm run generate -- --target=ruby
6
- # Source: integration-test-data/generators/src/targets/ruby.ts
7
- # Do NOT edit by hand — changes will be overwritten.
8
-
9
- require 'test_helper'
10
- require 'integration/test_helpers'
11
-
12
- class TestContextPrecedence < Minitest::Test
13
- def setup
14
- @store = IntegrationTestHelpers.build_store("context_precedence")
15
- end
16
-
17
- # returns the correct `flag` value using the global context (1)
18
- def test_returns_the_correct_flag_value_using_the_global_context_1
19
- resolver = IntegrationTestHelpers.build_resolver(@store)
20
- IntegrationTestHelpers.assert_enabled(resolver, "mixed.case.property.name", {"user" => {"isHuman" => "verified"}}, true)
21
- end
22
-
23
- # returns the correct `flag` value using the global context (2)
24
- def test_returns_the_correct_flag_value_using_the_global_context_2
25
- resolver = IntegrationTestHelpers.build_resolver(@store)
26
- IntegrationTestHelpers.assert_enabled(resolver, "mixed.case.property.name", {"user" => {"isHuman" => "?"}}, false)
27
- end
28
-
29
- # returns the correct `flag` value when local context clobbers global context (1)
30
- def test_returns_the_correct_flag_value_when_local_context_clobbers_global_context_1
31
- resolver = IntegrationTestHelpers.build_resolver(@store)
32
- IntegrationTestHelpers.assert_enabled(resolver, "mixed.case.property.name", {"user" => {"isHuman" => "verified"}}, true)
33
- end
34
-
35
- # returns the correct `flag` value when local context clobbers global context (2)
36
- def test_returns_the_correct_flag_value_when_local_context_clobbers_global_context_2
37
- resolver = IntegrationTestHelpers.build_resolver(@store)
38
- IntegrationTestHelpers.assert_enabled(resolver, "mixed.case.property.name", {"user" => {"isHuman" => "?"}}, false)
39
- end
40
-
41
- # returns the correct `flag` value when block context clobbers global context (1)
42
- def test_returns_the_correct_flag_value_when_block_context_clobbers_global_context_1
43
- resolver = IntegrationTestHelpers.build_resolver(@store)
44
- IntegrationTestHelpers.assert_enabled(resolver, "mixed.case.property.name", {"user" => {"isHuman" => "?"}}, false)
45
- end
46
-
47
- # returns the correct `flag` value when block context clobbers global context (2)
48
- def test_returns_the_correct_flag_value_when_block_context_clobbers_global_context_2
49
- resolver = IntegrationTestHelpers.build_resolver(@store)
50
- IntegrationTestHelpers.assert_enabled(resolver, "mixed.case.property.name", {"user" => {"isHuman" => "verified"}}, true)
51
- end
52
-
53
- # returns the correct `flag` value when local context clobbers block context (1)
54
- def test_returns_the_correct_flag_value_when_local_context_clobbers_block_context_1
55
- resolver = IntegrationTestHelpers.build_resolver(@store)
56
- IntegrationTestHelpers.assert_enabled(resolver, "mixed.case.property.name", {"user" => {"isHuman" => "?"}}, false)
57
- end
58
-
59
- # returns the correct `flag` value when local context clobbers block context (2)
60
- def test_returns_the_correct_flag_value_when_local_context_clobbers_block_context_2
61
- resolver = IntegrationTestHelpers.build_resolver(@store)
62
- IntegrationTestHelpers.assert_enabled(resolver, "mixed.case.property.name", {"user" => {"isHuman" => "verified"}}, true)
63
- end
64
-
65
- # returns the correct `get` value using the global context (1)
66
- def test_returns_the_correct_get_value_using_the_global_context_1
67
- resolver = IntegrationTestHelpers.build_resolver(@store)
68
- IntegrationTestHelpers.assert_resolved(resolver, "basic.rule.config", {"user" => {"email" => "test@prefab.cloud"}}, "override")
69
- end
70
-
71
- # returns the correct `get` value using the global context (2)
72
- def test_returns_the_correct_get_value_using_the_global_context_2
73
- resolver = IntegrationTestHelpers.build_resolver(@store)
74
- IntegrationTestHelpers.assert_resolved(resolver, "basic.rule.config", {"user" => {"email" => "test@example.com"}}, "default")
75
- end
76
-
77
- # returns the correct `get` value when local context clobbers global context (1)
78
- def test_returns_the_correct_get_value_when_local_context_clobbers_global_context_1
79
- resolver = IntegrationTestHelpers.build_resolver(@store)
80
- IntegrationTestHelpers.assert_resolved(resolver, "basic.rule.config", {"user" => {"email" => "test@prefab.cloud"}}, "override")
81
- end
82
-
83
- # returns the correct `get` value when local context clobbers global context (2)
84
- def test_returns_the_correct_get_value_when_local_context_clobbers_global_context_2
85
- resolver = IntegrationTestHelpers.build_resolver(@store)
86
- IntegrationTestHelpers.assert_resolved(resolver, "basic.rule.config", {"user" => {"email" => "test@example.com"}}, "default")
87
- end
88
-
89
- # returns the correct `get` value when block context clobbers global context (1)
90
- def test_returns_the_correct_get_value_when_block_context_clobbers_global_context_1
91
- resolver = IntegrationTestHelpers.build_resolver(@store)
92
- IntegrationTestHelpers.assert_resolved(resolver, "basic.rule.config", {"user" => {"email" => "test@example.com"}}, "default")
93
- end
94
-
95
- # returns the correct `get` value when block context clobbers global context (2)
96
- def test_returns_the_correct_get_value_when_block_context_clobbers_global_context_2
97
- resolver = IntegrationTestHelpers.build_resolver(@store)
98
- IntegrationTestHelpers.assert_resolved(resolver, "basic.rule.config", {"user" => {"email" => "test@prefab.cloud"}}, "override")
99
- end
100
-
101
- # returns the correct `get` value when local context clobbers block context (1)
102
- def test_returns_the_correct_get_value_when_local_context_clobbers_block_context_1
103
- resolver = IntegrationTestHelpers.build_resolver(@store)
104
- IntegrationTestHelpers.assert_resolved(resolver, "basic.rule.config", {"user" => {"email" => "test@example.com"}}, "default")
105
- end
106
-
107
- # returns the correct `get` value when local context clobbers block context (2)
108
- def test_returns_the_correct_get_value_when_local_context_clobbers_block_context_2
109
- resolver = IntegrationTestHelpers.build_resolver(@store)
110
- IntegrationTestHelpers.assert_resolved(resolver, "basic.rule.config", {"user" => {"email" => "test@prefab.cloud"}}, "override")
111
- end
112
- end
@@ -1,54 +0,0 @@
1
- # frozen_string_literal: true
2
- #
3
- # AUTO-GENERATED from integration-test-data/tests/eval/datadir_environment.yaml.
4
- # Regenerate with:
5
- # cd integration-test-data/generators && npm run generate -- --target=ruby
6
- # Source: integration-test-data/generators/src/targets/ruby.ts
7
- # Do NOT edit by hand — changes will be overwritten.
8
-
9
- require 'test_helper'
10
- require 'integration/test_helpers'
11
-
12
- class TestDatadirEnvironment < Minitest::Test
13
- def setup
14
- @store = IntegrationTestHelpers.build_store("datadir_environment")
15
- end
16
-
17
- # datadir with environment option gets environment-specific value
18
- def test_datadir_with_environment_option_gets_environment_specific_value
19
- client = Quonfig::Client.new(datadir: IntegrationTestHelpers.data_dir, environment: "Production")
20
- assert_equal "test4", client.get("james.test.key")
21
- end
22
-
23
- # datadir with QUONFIG_ENVIRONMENT env var gets environment-specific value
24
- def test_datadir_with_quonfig_environment_env_var_gets_environment_specific_value
25
- IntegrationTestHelpers.with_env({"QUONFIG_ENVIRONMENT" => "Production"}) do
26
- client = Quonfig::Client.new(datadir: IntegrationTestHelpers.data_dir)
27
- assert_equal "test4", client.get("james.test.key")
28
- end
29
- end
30
-
31
- # environment option supersedes QUONFIG_ENVIRONMENT env var
32
- def test_environment_option_supersedes_quonfig_environment_env_var
33
- IntegrationTestHelpers.with_env({"QUONFIG_ENVIRONMENT" => "nonexistent"}) do
34
- client = Quonfig::Client.new(datadir: IntegrationTestHelpers.data_dir, environment: "Production")
35
- assert_equal "test4", client.get("james.test.key")
36
- end
37
- end
38
-
39
- # config without environment override returns default value
40
- def test_config_without_environment_override_returns_default_value
41
- client = Quonfig::Client.new(datadir: IntegrationTestHelpers.data_dir, environment: "Production")
42
- assert_equal "hello from no env row", client.get("config.with.only.default.env.row")
43
- end
44
-
45
- # datadir without environment fails to init
46
- def test_datadir_without_environment_fails_to_init
47
- assert_raises(Quonfig::Errors::MissingEnvironmentError) { Quonfig::Client.new(datadir: IntegrationTestHelpers.data_dir) }
48
- end
49
-
50
- # datadir with invalid environment fails to init
51
- def test_datadir_with_invalid_environment_fails_to_init
52
- assert_raises(Quonfig::Errors::InvalidEnvironmentError) { Quonfig::Client.new(datadir: IntegrationTestHelpers.data_dir, environment: "nonexistent") }
53
- end
54
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
- #
3
- # AUTO-GENERATED from integration-test-data/tests/eval/dev_overrides.yaml.
4
- # Regenerate with:
5
- # cd integration-test-data/generators && npm run generate -- --target=ruby
6
- # Source: integration-test-data/generators/src/targets/ruby.ts
7
- # Do NOT edit by hand — changes will be overwritten.
8
-
9
- require 'test_helper'
10
- require 'integration/test_helpers'
11
-
12
- class TestDevOverrides < Minitest::Test
13
- def setup
14
- @store = IntegrationTestHelpers.build_store("dev_overrides")
15
- end
16
-
17
- # override fires when quonfig-user.email matches
18
- def test_override_fires_when_quonfig_user_email_matches
19
- resolver = IntegrationTestHelpers.build_resolver(@store)
20
- IntegrationTestHelpers.assert_enabled(resolver, "feature-flag.dev-override", {"quonfig-user" => {"email" => "bob@foo.com"}}, true)
21
- end
22
-
23
- # override does not fire when attribute absent (prod simulation)
24
- def test_override_does_not_fire_when_attribute_absent_prod_simulation
25
- resolver = IntegrationTestHelpers.build_resolver(@store)
26
- IntegrationTestHelpers.assert_enabled(resolver, "feature-flag.dev-override", {"user" => {"email" => "bob@foo.com"}}, false)
27
- end
28
-
29
- # override matches any email in IS_ONE_OF list
30
- def test_override_matches_any_email_in_is_one_of_list
31
- resolver = IntegrationTestHelpers.build_resolver(@store)
32
- IntegrationTestHelpers.assert_enabled(resolver, "feature-flag.dev-override.multi-email", {"quonfig-user" => {"email" => "alice@foo.com"}}, true)
33
- end
34
-
35
- # override beats customer rule by priority
36
- def test_override_beats_customer_rule_by_priority
37
- resolver = IntegrationTestHelpers.build_resolver(@store)
38
- IntegrationTestHelpers.assert_enabled(resolver, "feature-flag.dev-override.priority", {"quonfig-user" => {"email" => "bob@foo.com"}, "user" => {"country" => "DE"}}, true)
39
- end
40
- end