remote_config 1.0.0.pre.beta.1

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 (79) hide show
  1. checksums.yaml +7 -0
  2. data/.github/PULL_REQUEST_TEMPLATE.md +13 -0
  3. data/.github/workflows/continuous-deployment.yml +34 -0
  4. data/.github/workflows/continuous-integration.yml +45 -0
  5. data/.gitignore +58 -0
  6. data/.rubocop.yml +9 -0
  7. data/Gemfile +23 -0
  8. data/README.md +122 -0
  9. data/Rakefile +24 -0
  10. data/app/controllers/remote_config/application_controller.rb +5 -0
  11. data/app/models/remote_config/application_record.rb +8 -0
  12. data/bin/rails +14 -0
  13. data/config/routes.rb +3 -0
  14. data/lib/remote_config/adapters/base.rb +23 -0
  15. data/lib/remote_config/adapters/ruby_config_adapter.rb +32 -0
  16. data/lib/remote_config/engine.rb +7 -0
  17. data/lib/remote_config/exceptions.rb +47 -0
  18. data/lib/remote_config/flagging.rb +33 -0
  19. data/lib/remote_config/rails/routes.rb +11 -0
  20. data/lib/remote_config/version.rb +5 -0
  21. data/lib/remote_config.rb +50 -0
  22. data/remote-config.gemspec +21 -0
  23. data/spec/rails_app/.rspec +1 -0
  24. data/spec/rails_app/Rakefile +6 -0
  25. data/spec/rails_app/app/assets/config/manifest.js +3 -0
  26. data/spec/rails_app/app/assets/images/.keep +0 -0
  27. data/spec/rails_app/app/assets/stylesheets/application.css +15 -0
  28. data/spec/rails_app/app/channels/application_cable/channel.rb +4 -0
  29. data/spec/rails_app/app/channels/application_cable/connection.rb +4 -0
  30. data/spec/rails_app/app/controllers/application_controller.rb +2 -0
  31. data/spec/rails_app/app/controllers/concerns/.keep +0 -0
  32. data/spec/rails_app/app/helpers/application_helper.rb +2 -0
  33. data/spec/rails_app/app/jobs/application_job.rb +7 -0
  34. data/spec/rails_app/app/mailers/application_mailer.rb +4 -0
  35. data/spec/rails_app/app/models/application_record.rb +3 -0
  36. data/spec/rails_app/app/models/concerns/.keep +0 -0
  37. data/spec/rails_app/app/views/layouts/application.html.erb +15 -0
  38. data/spec/rails_app/app/views/layouts/mailer.html.erb +13 -0
  39. data/spec/rails_app/app/views/layouts/mailer.text.erb +1 -0
  40. data/spec/rails_app/bin/rails +4 -0
  41. data/spec/rails_app/bin/rake +4 -0
  42. data/spec/rails_app/bin/setup +33 -0
  43. data/spec/rails_app/config/application.rb +25 -0
  44. data/spec/rails_app/config/boot.rb +5 -0
  45. data/spec/rails_app/config/cable.yml +10 -0
  46. data/spec/rails_app/config/database.yml +25 -0
  47. data/spec/rails_app/config/environment.rb +5 -0
  48. data/spec/rails_app/config/environments/development.rb +70 -0
  49. data/spec/rails_app/config/environments/production.rb +93 -0
  50. data/spec/rails_app/config/environments/test.rb +60 -0
  51. data/spec/rails_app/config/initializers/assets.rb +12 -0
  52. data/spec/rails_app/config/initializers/content_security_policy.rb +26 -0
  53. data/spec/rails_app/config/initializers/filter_parameter_logging.rb +8 -0
  54. data/spec/rails_app/config/initializers/inflections.rb +16 -0
  55. data/spec/rails_app/config/initializers/permissions_policy.rb +11 -0
  56. data/spec/rails_app/config/locales/en.yml +33 -0
  57. data/spec/rails_app/config/puma.rb +43 -0
  58. data/spec/rails_app/config/routes.rb +3 -0
  59. data/spec/rails_app/config/storage.yml +34 -0
  60. data/spec/rails_app/config.ru +6 -0
  61. data/spec/rails_app/db/schema.rb +15 -0
  62. data/spec/rails_app/lib/assets/.keep +0 -0
  63. data/spec/rails_app/log/.keep +0 -0
  64. data/spec/rails_app/public/404.html +67 -0
  65. data/spec/rails_app/public/422.html +67 -0
  66. data/spec/rails_app/public/500.html +66 -0
  67. data/spec/rails_app/public/apple-touch-icon-precomposed.png +0 -0
  68. data/spec/rails_app/public/apple-touch-icon.png +0 -0
  69. data/spec/rails_app/public/favicon.ico +0 -0
  70. data/spec/rails_app/storage/.keep +0 -0
  71. data/spec/rails_app/tmp/.keep +0 -0
  72. data/spec/rails_app/tmp/development_secret.txt +1 -0
  73. data/spec/rails_app/tmp/pids/.keep +0 -0
  74. data/spec/rails_app/tmp/storage/.keep +0 -0
  75. data/spec/rails_helper.rb +66 -0
  76. data/spec/remote_config/adapters/ruby_config_adapter_spec.rb +83 -0
  77. data/spec/remote_config/flagging_spec.rb +171 -0
  78. data/spec/spec_helper.rb +97 -0
  79. metadata +118 -0
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1 @@
1
+ d90a1b024a961068dc43f41a23574d4ee08a970d89eef4d29681fe4eeac10e81672f2e951aee57707c18ef336df037861439072062b09fe8bdf909051afc8de6
File without changes
File without changes
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ ENV["RAILS_ENV"] ||= "test"
4
+ require_relative "./rails_app/config/environment"
5
+
6
+ # Prevent database truncation if the environment is production
7
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
8
+ require "rspec/rails"
9
+ # Add additional requires below this line. Rails is not loaded until this point!
10
+
11
+ # Requires supporting ruby files with custom matchers and macros, etc, in
12
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
13
+ # run as spec files by default. This means that files in spec/support that end
14
+ # in _spec.rb will both be required and run as specs, causing the specs to be
15
+ # run twice. It is recommended that you do not name files matching this glob to
16
+ # end with _spec.rb. You can configure this pattern with the --pattern
17
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
18
+ #
19
+ # The following line is provided for convenience purposes. It has the downside
20
+ # of increasing the boot-up time by auto-requiring all files in the support
21
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
22
+ # require only the support files necessary.
23
+ #
24
+ # Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }
25
+
26
+ # Checks for pending migrations and applies them before tests are run.
27
+ # If you are not using ActiveRecord, you can remove these lines.
28
+ begin
29
+ ActiveRecord::Migration.maintain_test_schema!
30
+ rescue ActiveRecord::PendingMigrationError => e
31
+ puts e.to_s.strip
32
+ exit 1
33
+ end
34
+
35
+ RSpec.configure do |config|
36
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
37
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
38
+
39
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
40
+ # examples within a transaction, remove the following line or assign false
41
+ # instead of true.
42
+ config.use_transactional_fixtures = true
43
+
44
+ # You can uncomment this line to turn off ActiveRecord support entirely.
45
+ # config.use_active_record = false
46
+
47
+ # RSpec Rails can automatically mix in different behaviours to your tests
48
+ # based on their file location, for example enabling you to call `get` and
49
+ # `post` in specs under `spec/controllers`.
50
+ #
51
+ # You can disable this behaviour by removing the line below, and instead
52
+ # explicitly tag your specs with their type, e.g.:
53
+ #
54
+ # RSpec.describe UsersController, type: :controller do
55
+ # # ...
56
+ # end
57
+ #
58
+ # The different available types are documented in the features, such as in
59
+ # https://relishapp.com/rspec/rspec-rails/docs
60
+ config.infer_spec_type_from_file_location!
61
+
62
+ # Filter lines from Rails gems in backtraces.
63
+ config.filter_rails_from_backtrace!
64
+ # arbitrary gems may also be filtered via:
65
+ # config.filter_gems_from_backtrace("gem name")
66
+ end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails_helper"
4
+
5
+ RSpec.describe RemoteConfig::Adapters::RubyConfigAdapter do
6
+ subject(:adapter) do
7
+ described_class.new({
8
+ const_name: "Settings",
9
+ feature_flags_key: "feature_flags",
10
+ release_flags_key: "release_flags"
11
+ })
12
+ end
13
+
14
+ let(:settings_class) { Class.new }
15
+
16
+ before do
17
+ stub_const("Settings", Config::Options.new.tap do |options|
18
+ options.add_source!({
19
+ "feature_flags" => {
20
+ "hocus" => {
21
+ "_" => true,
22
+ "pocus" => {
23
+ "alakazam" => true,
24
+ "smellakazam" => false
25
+ }
26
+ }
27
+ },
28
+ "release_flags" => {
29
+ "tomatoes" => {
30
+ "_" => true,
31
+ "canned" => {
32
+ "diced" => true,
33
+ "whole" => false
34
+ }
35
+ }
36
+ }
37
+ })
38
+ options.reload!
39
+ end)
40
+ end
41
+
42
+ describe "#fetch_feature_flag" do
43
+ it "returns nil when the key is missing" do
44
+ expect(adapter.fetch_feature_flag("null")).to be(nil)
45
+ expect(adapter.fetch_feature_flag("hocus.null")).to be(nil)
46
+ expect(adapter.fetch_feature_flag("hocus.pocus.alakazam.null")).to be(nil)
47
+ end
48
+
49
+ it "returns the value of the key when present" do
50
+ expect(adapter.fetch_feature_flag("hocus.pocus.alakazam")).to be(true)
51
+ expect(adapter.fetch_feature_flag("hocus.pocus.smellakazam")).to be(false)
52
+ end
53
+
54
+ it "returns the _ value of a found hash when present" do
55
+ expect(adapter.fetch_feature_flag("hocus")).to be(true)
56
+ end
57
+
58
+ it "returns nil when the _ value is missing from a found hash" do
59
+ expect(adapter.fetch_feature_flag("hocus.pocus")).to be(nil)
60
+ end
61
+ end
62
+
63
+ describe "#fetch_release_flag" do
64
+ it "returns nil when the key is missing" do
65
+ expect(adapter.fetch_release_flag("null")).to be(nil)
66
+ expect(adapter.fetch_release_flag("tomatoes.null")).to be(nil)
67
+ expect(adapter.fetch_release_flag("tomatoes.canned.diced.null")).to be(nil)
68
+ end
69
+
70
+ it "returns the value of the key when present" do
71
+ expect(adapter.fetch_release_flag("tomatoes.canned.diced")).to be(true)
72
+ expect(adapter.fetch_release_flag("tomatoes.canned.whole")).to be(false)
73
+ end
74
+
75
+ it "returns the _ value of a found hash when present" do
76
+ expect(adapter.fetch_release_flag("tomatoes")).to be(true)
77
+ end
78
+
79
+ it "returns nil when the _ value is missing from a found hash" do
80
+ expect(adapter.fetch_release_flag("tomatoes.canned")).to be(nil)
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,171 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails_helper"
4
+
5
+ RSpec.describe RemoteConfig::Flagging do
6
+ subject :instance do
7
+ test_class.new
8
+ end
9
+
10
+ let :test_class do
11
+ Class.new do
12
+ include RemoteConfig::Flagging
13
+ end
14
+ end
15
+
16
+ describe "#feature_enabled?" do
17
+ let(:key) { "hocus.pocus" }
18
+ let(:adapter_double) { instance_double(RemoteConfig::Adapters::RubyConfigAdapter) }
19
+
20
+ before do
21
+ allow(RemoteConfig).to receive(:adapter).and_return(adapter_double)
22
+ end
23
+
24
+ context "when the adapter cannot find a value for the key" do
25
+ it "raises a `RemoteConfig::UnknownFeatureFlagError` error" do
26
+ allow(adapter_double).to receive(:fetch_feature_flag).with(key).and_return(nil)
27
+ expect { instance.feature_enabled? key }
28
+ .to raise_error(
29
+ an_instance_of(RemoteConfig::UnknownFeatureFlagError)
30
+ .and(having_attributes(key: key))
31
+ )
32
+ end
33
+ end
34
+
35
+ context "when the adapter returns true for the key" do
36
+ before do
37
+ allow(adapter_double).to receive(:fetch_feature_flag)
38
+ .with(key).and_return(true)
39
+ end
40
+
41
+ it "returns true" do
42
+ expect(instance.feature_enabled?(key)).to be(true)
43
+ end
44
+
45
+ it "yields a given block and returns true" do
46
+ block_yielded = false
47
+ return_value = instance.feature_enabled?(key) { block_yielded = true }
48
+
49
+ expect(block_yielded).to be(true)
50
+ expect(return_value).to be(true)
51
+ end
52
+ end
53
+
54
+ context "when the adapter returns false for the key" do
55
+ before do
56
+ allow(adapter_double).to receive(:fetch_feature_flag)
57
+ .with(key).and_return(false)
58
+ end
59
+
60
+ it "returns false" do
61
+ expect(instance.feature_enabled?(key)).to be(false)
62
+ end
63
+
64
+ it "doesn't yield the given block and returns false" do
65
+ block_yielded = false
66
+ return_value = instance.feature_enabled?(key) { block_yielded = true }
67
+
68
+ expect(block_yielded).to be(false)
69
+ expect(return_value).to be(false)
70
+ end
71
+ end
72
+
73
+ context "when the adapter returns a non-boolean value" do
74
+ before do
75
+ allow(adapter_double).to receive(:fetch_feature_flag)
76
+ .with(key).and_return("alakazam")
77
+ end
78
+
79
+ it "raises a `RemoteConfig::NonBooleanFeatureFlagError`" do
80
+ expect { instance.feature_enabled? key }
81
+ .to raise_error(
82
+ an_instance_of(RemoteConfig::NonBooleanFeatureFlagError)
83
+ .and(having_attributes(key: key))
84
+ )
85
+ end
86
+ end
87
+ end
88
+
89
+ describe "#released?" do
90
+ # rubocop:disable Rails/Inquiry
91
+ let(:key) { "hocus.pocus" }
92
+ let(:adapter_double) { instance_double(RemoteConfig::Adapters::RubyConfigAdapter) }
93
+
94
+ before do
95
+ allow(RemoteConfig).to receive(:adapter).and_return(adapter_double)
96
+
97
+ RemoteConfig.configure do |config|
98
+ config.release_stages = {
99
+ production: %i[production uat development],
100
+ uat: %i[uat development],
101
+ development: %i[development]
102
+ }
103
+ end
104
+ end
105
+
106
+ context "when the adapter cannot find a value for the key" do
107
+ it "raises a `RemoteConfig::UnknownReleaseFlagError` error" do
108
+ allow(adapter_double).to receive(:fetch_release_flag).with(key).and_return(nil)
109
+ expect { instance.released? key }
110
+ .to raise_error(
111
+ an_instance_of(RemoteConfig::UnknownReleaseFlagError)
112
+ .and(having_attributes(key: key))
113
+ )
114
+ end
115
+ end
116
+
117
+ context "when the current environment is in the flags current release stage" do
118
+ before do
119
+ allow(Rails).to receive(:env).and_return("development".inquiry)
120
+ allow(adapter_double).to receive(:fetch_release_flag)
121
+ .with(key).and_return("development")
122
+ end
123
+
124
+ it "returns true" do
125
+ expect(instance.released?(key)).to be(true)
126
+ end
127
+
128
+ it "yields a given block and returns true" do
129
+ block_yielded = false
130
+ return_value = instance.released?(key) { block_yielded = true }
131
+
132
+ expect(block_yielded).to be(true)
133
+ expect(return_value).to be(true)
134
+ end
135
+ end
136
+
137
+ context "when the current environment is not in the flags current release stage" do
138
+ before do
139
+ allow(Rails).to receive(:env).and_return("uat".inquiry)
140
+ allow(adapter_double).to receive(:fetch_release_flag)
141
+ .with(key).and_return("development")
142
+ end
143
+
144
+ it "returns false" do
145
+ expect(instance.released?(key)).to be(false)
146
+ end
147
+
148
+ it "doesn't yield the given block and returns false" do
149
+ block_yielded = false
150
+ return_value = instance.released?(key) { block_yielded = true }
151
+
152
+ expect(block_yielded).to be(false)
153
+ expect(return_value).to be(false)
154
+ end
155
+ end
156
+
157
+ context "when the flags current release stage not a recognised release stage" do
158
+ it "raises a `RemoteConfig::UnkownReleaseStageError` error" do
159
+ allow(adapter_double).to receive(:fetch_release_flag).with(key).and_return("misc")
160
+ allow(Rails).to receive(:env).and_return("development".inquiry)
161
+
162
+ expect { instance.released? key }
163
+ .to raise_error(
164
+ an_instance_of(RemoteConfig::UnknownReleaseStageError)
165
+ .and(having_attributes(key: key, value: "misc"))
166
+ )
167
+ end
168
+ end
169
+ # rubocop:enable Rails/Inquiry
170
+ end
171
+ end
@@ -0,0 +1,97 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pry"
4
+ require "remote_config"
5
+
6
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
7
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
8
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
9
+ # this file to always be loaded, without a need to explicitly require it in any
10
+ # files.
11
+ #
12
+ # Given that it is always loaded, you are encouraged to keep this file as
13
+ # light-weight as possible. Requiring heavyweight dependencies from this file
14
+ # will add to the boot time of your test suite on EVERY test run, even for an
15
+ # individual file that may not need all of that loaded. Instead, consider making
16
+ # a separate helper file that requires the additional dependencies and performs
17
+ # the additional setup, and require it from the spec files that actually need
18
+ # it.
19
+ #
20
+ # See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
21
+ RSpec.configure do |config|
22
+ # rspec-expectations config goes here. You can use an alternate
23
+ # assertion/expectation library such as wrong or the stdlib/minitest
24
+ # assertions if you prefer.
25
+ config.expect_with :rspec do |expectations|
26
+ # This option will default to `true` in RSpec 4. It makes the `description`
27
+ # and `failure_message` of custom matchers include text for helper methods
28
+ # defined using `chain`, e.g.:
29
+ # be_bigger_than(2).and_smaller_than(4).description
30
+ # # => "be bigger than 2 and smaller than 4"
31
+ # ...rather than:
32
+ # # => "be bigger than 2"
33
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
34
+ end
35
+
36
+ # rspec-mocks config goes here. You can use an alternate test double
37
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
38
+ config.mock_with :rspec do |mocks|
39
+ # Prevents you from mocking or stubbing a method that does not exist on
40
+ # a real object. This is generally recommended, and will default to
41
+ # `true` in RSpec 4.
42
+ mocks.verify_partial_doubles = true
43
+ end
44
+
45
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
46
+ # have no way to turn it off -- the option exists only for backwards
47
+ # compatibility in RSpec 3). It causes shared context metadata to be
48
+ # inherited by the metadata hash of host groups and examples, rather than
49
+ # triggering implicit auto-inclusion in groups with matching metadata.
50
+ config.shared_context_metadata_behavior = :apply_to_host_groups
51
+
52
+ # The settings below are suggested to provide a good initial experience
53
+ # with RSpec, but feel free to customize to your heart's content.
54
+ # # This allows you to limit a spec run to individual examples or groups
55
+ # # you care about by tagging them with `:focus` metadata. When nothing
56
+ # # is tagged with `:focus`, all examples get run. RSpec also provides
57
+ # # aliases for `it`, `describe`, and `context` that include `:focus`
58
+ # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
59
+ # config.filter_run_when_matching :focus
60
+ #
61
+ # # Allows RSpec to persist some state between runs in order to support
62
+ # # the `--only-failures` and `--next-failure` CLI options. We recommend
63
+ # # you configure your source control system to ignore this file.
64
+ # config.example_status_persistence_file_path = "spec/examples.txt"
65
+ #
66
+ # # Limits the available syntax to the non-monkey patched syntax that is
67
+ # # recommended. For more details, see:
68
+ # # https://relishapp.com/rspec/rspec-core/docs/configuration/zero-monkey-patching-mode
69
+ # config.disable_monkey_patching!
70
+ #
71
+ # # Many RSpec users commonly either run the entire suite or an individual
72
+ # # file, and it's useful to allow more verbose output when running an
73
+ # # individual spec file.
74
+ # if config.files_to_run.one?
75
+ # # Use the documentation formatter for detailed output,
76
+ # # unless a formatter has already been configured
77
+ # # (e.g. via a command-line flag).
78
+ # config.default_formatter = "doc"
79
+ # end
80
+ #
81
+ # # Print the 10 slowest examples and example groups at the
82
+ # # end of the spec run, to help surface which specs are running
83
+ # # particularly slow.
84
+ # config.profile_examples = 10
85
+ #
86
+ # # Run specs in random order to surface order dependencies. If you find an
87
+ # # order dependency and want to debug it, you can fix the order by providing
88
+ # # the seed, which is printed after each run.
89
+ # # --seed 1234
90
+ # config.order = :random
91
+ #
92
+ # # Seed global randomization in this process using the `--seed` CLI option.
93
+ # # Setting this allows you to use `--seed` to deterministically reproduce
94
+ # # test failures related to randomization by passing the same `--seed` value
95
+ # # as the one that triggered the failure.
96
+ # Kernel.srand config.seed
97
+ end