webvalve 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -1
  3. data/README.md +1 -1
  4. data/lib/webvalve/fake_service_config.rb +6 -3
  5. data/lib/webvalve/manager.rb +17 -3
  6. data/lib/webvalve/railtie.rb +0 -5
  7. data/lib/webvalve/rspec.rb +1 -1
  8. data/lib/webvalve/version.rb +1 -1
  9. data/lib/webvalve.rb +14 -3
  10. data/spec/dummy/config/application.rb +3 -23
  11. data/spec/examples.txt +66 -59
  12. data/spec/spec_helper.rb +3 -1
  13. data/spec/support/rails_root.rb +7 -0
  14. data/spec/webvalve/fake_service_spec.rb +1 -1
  15. data/spec/webvalve/manager_spec.rb +15 -0
  16. metadata +24 -77
  17. data/spec/dummy/README.rdoc +0 -28
  18. data/spec/dummy/Rakefile +0 -6
  19. data/spec/dummy/app/assets/config/manifest.js +0 -3
  20. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  21. data/spec/dummy/app/assets/stylesheets/application.css +0 -15
  22. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  23. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  24. data/spec/dummy/app/views/layouts/application.html.erb +0 -13
  25. data/spec/dummy/bin/bundle +0 -3
  26. data/spec/dummy/bin/rails +0 -4
  27. data/spec/dummy/bin/rake +0 -4
  28. data/spec/dummy/bin/setup +0 -29
  29. data/spec/dummy/config/boot.rb +0 -5
  30. data/spec/dummy/config/database.yml +0 -25
  31. data/spec/dummy/config/environment.rb +0 -5
  32. data/spec/dummy/config/environments/development.rb +0 -41
  33. data/spec/dummy/config/environments/production.rb +0 -79
  34. data/spec/dummy/config/environments/test.rb +0 -42
  35. data/spec/dummy/config/initializers/assets.rb +0 -11
  36. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  37. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
  38. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  39. data/spec/dummy/config/initializers/inflections.rb +0 -16
  40. data/spec/dummy/config/initializers/mime_types.rb +0 -4
  41. data/spec/dummy/config/initializers/session_store.rb +0 -3
  42. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  43. data/spec/dummy/config/locales/en.yml +0 -23
  44. data/spec/dummy/config/routes.rb +0 -2
  45. data/spec/dummy/config/secrets.yml +0 -22
  46. data/spec/dummy/config.ru +0 -4
  47. data/spec/dummy/log/test.log +0 -24
  48. data/spec/dummy/public/404.html +0 -67
  49. data/spec/dummy/public/422.html +0 -67
  50. data/spec/dummy/public/500.html +0 -66
  51. data/spec/dummy/public/favicon.ico +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5da39e3192b0ca68909782d930f60bbcb854b9f1d81f2f2e48ab5ce485d6758b
4
- data.tar.gz: a5deb923fb76b3d4e1a084a012d671fc3689cdd61f24255f869217f2527e46a7
3
+ metadata.gz: 3e0bd9695d36fa852af70059c6b101a2452e20f01b4b8a53aa7c52583618f413
4
+ data.tar.gz: 0b75b4a0d19ab3459105fe9a433416faca1d2de18ed5c2758d8f841e156a8f60
5
5
  SHA512:
6
- metadata.gz: 406fca19f30cffb98fd401667ef41038dc1b45f7ee0ff255a9ecb01359dbbef1ac35209bd15b0202790072b8f9f09b82fa8069457d6fb777305719d797024032
7
- data.tar.gz: 00e5633ca9ee5932dd0af9344e15c2e580f8d550e2ad8a6500a9a952f4f973892df349119bd36e2ebc5540f2e6445671471dd20bcefa9de18ac243bdad08c1f4
6
+ metadata.gz: 45c15aac6732c0da81fa91eeec6e9a1bfb8ad5d8aeeca07f567d05e9de03ec5765dbfd6053e22f7dc16f660e41d75a8052ea3f5dd548386b3d8d82fe27355bc7
7
+ data.tar.gz: 0e6a1709246c23e3ef4c482767275d78ed458333f344bcaf96132662a0b373b30eff174560b806de68b84b6cf04e1d83ba9facd102e0b7d0f0d7d98fc0083ad3
data/CHANGELOG.md CHANGED
@@ -9,6 +9,31 @@ and this project aims to adhere to [Semantic Versioning](http://semver.org/spec/
9
9
  ### Added
10
10
  ### Removed
11
11
 
12
+ ## [1.2.0] - 2021-12-16
13
+ ### Added
14
+ - Official support for Ruby 2.7 and 3.0
15
+ - Official support for Rails 6.2 and 7.0
16
+ ### Removed
17
+ - Drops support for Rails < 5.2
18
+ - Drops support for Ruby < 2.6
19
+
20
+ ## [1.1.0] - 2020-04-27
21
+ ### Changed
22
+ - Allow the same URL for services as long as basic auth is different
23
+ (https://github.com/Betterment/webvalve/pull/46)
24
+ - Introduce `reset!` and `clear!` to replace `reset`
25
+ https://github.com/Betterment/webvalve/pull/45)
26
+
27
+ ## [1.0.2] - 2020-04-27
28
+ ### Changed
29
+ - Fix an issue with setup / reset
30
+ (https://github.com/Betterment/webvalve/pull/44)
31
+
32
+ ## [1.0.1] - 2020-04-24
33
+ ### Changed
34
+ - Fix an issue in rspec setup / usage of `WebValve.reset`
35
+ (https://github.com/Betterment/webvalve/pull/43)
36
+
12
37
  ## [1.0.0] - 2020-04-22
13
38
  ### Changed
14
39
  - Support API_URLs that include path
@@ -57,7 +82,11 @@ and this project aims to adhere to [Semantic Versioning](http://semver.org/spec/
57
82
  ### Changed
58
83
  - WebMock 3+ support from @messanjah (https://github.com/Betterment/webvalve/pull/22)
59
84
 
60
- [Unreleased]: https://github.com/Betterment/webvalve/compare/v1.0.0...HEAD
85
+ [Unreleased]: https://github.com/Betterment/webvalve/compare/v1.2.0...HEAD
86
+ [1.2.0]: https://github.com/Betterment/webvalve/compare/v1.1.0...v1.2.0
87
+ [1.1.0]: https://github.com/Betterment/webvalve/compare/v1.0.2...v1.1.0
88
+ [1.0.2]: https://github.com/Betterment/webvalve/compare/v1.0.1...v1.0.2
89
+ [1.0.1]: https://github.com/Betterment/webvalve/compare/v1.0.0...v1.0.1
61
90
  [1.0.0]: https://github.com/Betterment/webvalve/compare/v0.12.0...v1.0.0
62
91
  [0.12.0]: https://github.com/Betterment/webvalve/compare/v0.11.0...v0.12.0
63
92
  [0.11.0]: https://github.com/Betterment/webvalve/compare/v0.10.0...v0.11.0
data/README.md CHANGED
@@ -170,7 +170,7 @@ RSpec.configure do |config|
170
170
  end
171
171
 
172
172
  config.around :each do |ex|
173
- WebValve.setup
173
+ WebValve.reset!
174
174
  ex.run
175
175
  end
176
176
  end
@@ -15,11 +15,14 @@ module WebValve
15
15
  value_from_env.present? && WebValve::DISABLED_VALUES.include?(value_from_env.to_s)
16
16
  end
17
17
 
18
+ def full_url
19
+ @full_url ||= custom_service_url || default_service_url
20
+ end
21
+
18
22
  def service_url
19
23
  @service_url ||= begin
20
- url = custom_service_url || default_service_url
21
- raise missing_url_message if url.blank?
22
- strip_basic_auth url
24
+ raise missing_url_message if full_url.blank?
25
+ strip_basic_auth full_url
23
26
  end
24
27
  end
25
28
 
@@ -24,6 +24,7 @@ module WebValve
24
24
 
25
25
  def setup
26
26
  return unless enabled?
27
+ load_configs!
27
28
 
28
29
  if intercepting?
29
30
  fake_service_configs.each do |config|
@@ -66,7 +67,13 @@ module WebValve
66
67
  end
67
68
 
68
69
  # @api private
69
- def reset
70
+ def reset!
71
+ clear!
72
+ setup
73
+ end
74
+
75
+ # @api private
76
+ def clear!
70
77
  allowlisted_urls.clear
71
78
  fake_service_configs.clear
72
79
  stubbed_urls.clear
@@ -145,8 +152,15 @@ module WebValve
145
152
  end
146
153
 
147
154
  def ensure_non_duplicate_stub(config)
148
- raise "Invalid config for #{config.service_class_name}. Already stubbed url #{config.service_url}" if stubbed_urls.include?(config.service_url)
149
- stubbed_urls << config.service_url
155
+ raise "Invalid config for #{config.service_class_name}. Already stubbed url #{config.full_url}" if stubbed_urls.include?(config.full_url)
156
+ stubbed_urls << config.full_url
157
+ end
158
+
159
+ def load_configs!
160
+ WebValve.config_paths.each do |root|
161
+ path = root.join('config', 'webvalve.rb').to_s
162
+ load path if File.exist?(path)
163
+ end
150
164
  end
151
165
 
152
166
  def stubbed_urls
@@ -12,11 +12,6 @@ module WebValve
12
12
 
13
13
  initializer 'webvalve.setup', after: :load_config_initializers do
14
14
  if WebValve.enabled?
15
- WebValve.config_paths.each do |root|
16
- path = root.join('config', 'webvalve.rb').to_s
17
- load path if File.exist?(path)
18
- end
19
-
20
15
  config.after_initialize do
21
16
  WebValve.setup
22
17
  end
@@ -3,7 +3,7 @@ require 'webmock/rspec'
3
3
 
4
4
  RSpec.configure do |c|
5
5
  c.around do |example|
6
- WebValve.setup
6
+ WebValve.reset!
7
7
  example.run
8
8
  end
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module WebValve
2
- VERSION = "1.0.0"
2
+ VERSION = "1.2.0"
3
3
  end
data/lib/webvalve.rb CHANGED
@@ -10,11 +10,13 @@ module WebValve
10
10
  # @see WebValve::Manager#register
11
11
  # @!method allow_url
12
12
  # @see WebValve::Manager#allow_url
13
- # @!method reset
14
- # @see WebValve::Manager#reset
13
+ # @!method reset!
14
+ # @see WebValve::Manager#reset!
15
+ # @!method clear!
16
+ # @see WebValve::Manager#clear!
15
17
  # @!method enabled?
16
18
  # @see WebValve::Manager#enabled?
17
- delegate :setup, :register, :allow_url, :reset, :enabled?, to: :manager
19
+ delegate :setup, :register, :allow_url, :reset!, :clear!, :enabled?, to: :manager
18
20
  attr_writer :logger
19
21
 
20
22
  def config_paths
@@ -52,6 +54,15 @@ module WebValve
52
54
  def manager
53
55
  WebValve::Manager.instance
54
56
  end
57
+
58
+ def reset
59
+ ActiveSupport::Deprecation.warn <<~WARN.squish
60
+ `WebValve.reset` is deprecated.
61
+ Please use `WebValve.clear!` (the old 'reset' behavior)
62
+ or `WebValve.reset!` (which also runs 'setup')
63
+ WARN
64
+ clear!
65
+ end
55
66
  end
56
67
  end
57
68
 
@@ -1,28 +1,8 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- # Pick the frameworks you want:
4
- require "active_record/railtie"
5
- require "action_controller/railtie"
6
- require "action_mailer/railtie"
7
- require "action_view/railtie"
8
- require "sprockets/railtie"
9
-
10
- Bundler.require(*Rails.groups)
11
- require "webvalve"
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
2
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
3
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
12
4
 
13
5
  module Dummy
14
6
  class Application < Rails::Application
15
- # Settings in config/environments/* take precedence over those specified here.
16
- # Application configuration should go into files in config/initializers
17
- # -- all .rb files in that directory are automatically loaded.
18
-
19
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
20
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
21
- # config.time_zone = 'Central Time (US & Canada)'
22
-
23
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
24
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
25
- # config.i18n.default_locale = :de
26
7
  end
27
8
  end
28
-
data/spec/examples.txt CHANGED
@@ -1,61 +1,68 @@
1
1
  example_id | status | run_time |
2
2
  -------------------------------------------------- | ------ | --------------- |
3
- ./spec/webvalve/fake_service_config_spec.rb[1:1:1] | passed | 0.00032 seconds |
4
- ./spec/webvalve/fake_service_config_spec.rb[1:1:2] | passed | 0.00406 seconds |
5
- ./spec/webvalve/fake_service_config_spec.rb[1:2:1] | passed | 0.00014 seconds |
6
- ./spec/webvalve/fake_service_config_spec.rb[1:2:2] | passed | 0.00015 seconds |
7
- ./spec/webvalve/fake_service_config_spec.rb[1:3:1] | passed | 0.00215 seconds |
8
- ./spec/webvalve/fake_service_config_spec.rb[1:3:2] | passed | 0.00019 seconds |
9
- ./spec/webvalve/fake_service_config_spec.rb[1:3:3] | passed | 0.00013 seconds |
10
- ./spec/webvalve/fake_service_spec.rb[1:1] | passed | 0.01281 seconds |
11
- ./spec/webvalve/fake_service_spec.rb[1:2:1] | passed | 0.02669 seconds |
12
- ./spec/webvalve/fake_service_spec.rb[1:2:2] | passed | 0.03046 seconds |
13
- ./spec/webvalve/manager_spec.rb[1:1] | passed | 0.0002 seconds |
14
- ./spec/webvalve/manager_spec.rb[1:2:1] | passed | 0.00387 seconds |
15
- ./spec/webvalve/manager_spec.rb[1:3:1] | passed | 0.00026 seconds |
16
- ./spec/webvalve/manager_spec.rb[1:4:1] | passed | 0.00015 seconds |
17
- ./spec/webvalve/manager_spec.rb[1:5:1:1] | passed | 0.00027 seconds |
18
- ./spec/webvalve/manager_spec.rb[1:5:2:1] | passed | 0.00027 seconds |
19
- ./spec/webvalve/manager_spec.rb[1:5:2:2] | passed | 0.00036 seconds |
20
- ./spec/webvalve/manager_spec.rb[1:5:2:3] | passed | 0.00681 seconds |
21
- ./spec/webvalve/manager_spec.rb[1:5:2:4] | passed | 0.00042 seconds |
22
- ./spec/webvalve/manager_spec.rb[1:5:2:5] | passed | 0.01559 seconds |
23
- ./spec/webvalve/manager_spec.rb[1:5:2:6] | passed | 0.00192 seconds |
24
- ./spec/webvalve/manager_spec.rb[1:5:3:1:1] | passed | 0.00026 seconds |
25
- ./spec/webvalve/manager_spec.rb[1:5:3:2:1] | passed | 0.00053 seconds |
26
- ./spec/webvalve/manager_spec.rb[1:5:3:2:2] | passed | 0.00066 seconds |
27
- ./spec/webvalve/manager_spec.rb[1:5:3:2:3] | passed | 0.0004 seconds |
28
- ./spec/webvalve/manager_spec.rb[1:5:4:1] | passed | 0.00036 seconds |
29
- ./spec/webvalve/manager_spec.rb[1:5:4:2] | passed | 0.0007 seconds |
30
- ./spec/webvalve/manager_spec.rb[1:6:1:1] | passed | 0.0002 seconds |
31
- ./spec/webvalve/manager_spec.rb[1:6:1:2] | passed | 0.00149 seconds |
32
- ./spec/webvalve/manager_spec.rb[1:6:2:1] | passed | 0.00014 seconds |
33
- ./spec/webvalve/manager_spec.rb[1:6:2:2] | passed | 0.00109 seconds |
34
- ./spec/webvalve/manager_spec.rb[1:6:2:3] | passed | 0.00037 seconds |
35
- ./spec/webvalve/manager_spec.rb[1:6:3:1] | passed | 0.00013 seconds |
36
- ./spec/webvalve/manager_spec.rb[1:6:3:2] | passed | 0.00012 seconds |
37
- ./spec/webvalve/manager_spec.rb[1:6:3:3] | passed | 0.0001 seconds |
38
- ./spec/webvalve/manager_spec.rb[1:6:3:4] | passed | 0.00011 seconds |
39
- ./spec/webvalve/manager_spec.rb[1:6:3:5] | passed | 0.00011 seconds |
40
- ./spec/webvalve/manager_spec.rb[1:7:1:1] | passed | 0.00011 seconds |
41
- ./spec/webvalve/manager_spec.rb[1:7:1:2] | passed | 0.00045 seconds |
42
- ./spec/webvalve/manager_spec.rb[1:7:2:1] | passed | 0.00011 seconds |
43
- ./spec/webvalve/manager_spec.rb[1:7:2:2] | passed | 0.00031 seconds |
44
- ./spec/webvalve/manager_spec.rb[1:7:2:3] | passed | 0.0001 seconds |
45
- ./spec/webvalve/manager_spec.rb[1:7:3:1] | passed | 0.00013 seconds |
46
- ./spec/webvalve/manager_spec.rb[1:7:3:2] | passed | 0.00012 seconds |
47
- ./spec/webvalve/manager_spec.rb[1:7:3:3] | passed | 0.00016 seconds |
48
- ./spec/webvalve/manager_spec.rb[1:7:3:4] | passed | 0.00016 seconds |
49
- ./spec/webvalve/manager_spec.rb[1:7:3:5] | passed | 0.00011 seconds |
50
- ./spec/webvalve/manager_spec.rb[1:8:1:1] | passed | 0.00008 seconds |
51
- ./spec/webvalve/manager_spec.rb[1:8:1:2] | passed | 0.00028 seconds |
52
- ./spec/webvalve/manager_spec.rb[1:8:2:1] | passed | 0.0001 seconds |
53
- ./spec/webvalve/manager_spec.rb[1:8:2:2] | passed | 0.00034 seconds |
54
- ./spec/webvalve/manager_spec.rb[1:8:3:1] | passed | 0.0001 seconds |
55
- ./spec/webvalve/manager_spec.rb[1:8:3:2] | passed | 0.00009 seconds |
56
- ./spec/webvalve/manager_spec.rb[1:8:3:3] | passed | 0.00008 seconds |
57
- ./spec/webvalve/manager_spec.rb[1:8:3:4] | passed | 0.00007 seconds |
58
- ./spec/webvalve_spec.rb[1:1] | passed | 0.0001 seconds |
59
- ./spec/webvalve_spec.rb[1:2] | passed | 0.00326 seconds |
60
- ./spec/webvalve_spec.rb[1:3] | passed | 0.00021 seconds |
61
- ./spec/webvalve_spec.rb[1:4] | passed | 0.00042 seconds |
3
+ ./spec/webvalve/fake_service_config_spec.rb[1:1:1] | passed | 0.00005 seconds |
4
+ ./spec/webvalve/fake_service_config_spec.rb[1:1:2] | passed | 0.00009 seconds |
5
+ ./spec/webvalve/fake_service_config_spec.rb[1:2:1] | passed | 0.00181 seconds |
6
+ ./spec/webvalve/fake_service_config_spec.rb[1:2:2] | passed | 0.00007 seconds |
7
+ ./spec/webvalve/fake_service_config_spec.rb[1:3:1] | passed | 0.00006 seconds |
8
+ ./spec/webvalve/fake_service_config_spec.rb[1:3:2] | passed | 0.00004 seconds |
9
+ ./spec/webvalve/fake_service_config_spec.rb[1:3:3] | passed | 0.00008 seconds |
10
+ ./spec/webvalve/fake_service_config_spec.rb[1:4:1] | passed | 0.00006 seconds |
11
+ ./spec/webvalve/fake_service_config_spec.rb[1:4:2] | passed | 0.00008 seconds |
12
+ ./spec/webvalve/fake_service_config_spec.rb[1:4:3] | passed | 0.00007 seconds |
13
+ ./spec/webvalve/fake_service_spec.rb[1:1] | passed | 0.00084 seconds |
14
+ ./spec/webvalve/fake_service_spec.rb[1:2:1:1] | passed | 0.00096 seconds |
15
+ ./spec/webvalve/fake_service_spec.rb[1:2:1:2] | passed | 0.00065 seconds |
16
+ ./spec/webvalve/fake_service_spec.rb[1:2:2:1] | passed | 0.00145 seconds |
17
+ ./spec/webvalve/fake_service_spec.rb[1:2:2:2] | passed | 0.00791 seconds |
18
+ ./spec/webvalve/manager_spec.rb[1:1] | passed | 0.00002 seconds |
19
+ ./spec/webvalve/manager_spec.rb[1:2:1] | passed | 0.00072 seconds |
20
+ ./spec/webvalve/manager_spec.rb[1:3:1] | passed | 0.00012 seconds |
21
+ ./spec/webvalve/manager_spec.rb[1:4:1] | passed | 0.00008 seconds |
22
+ ./spec/webvalve/manager_spec.rb[1:5:1:1] | passed | 0.00011 seconds |
23
+ ./spec/webvalve/manager_spec.rb[1:5:2:1] | passed | 0.00009 seconds |
24
+ ./spec/webvalve/manager_spec.rb[1:5:2:2] | passed | 0.00018 seconds |
25
+ ./spec/webvalve/manager_spec.rb[1:5:2:3] | passed | 0.0002 seconds |
26
+ ./spec/webvalve/manager_spec.rb[1:5:2:4] | passed | 0.00021 seconds |
27
+ ./spec/webvalve/manager_spec.rb[1:5:2:5] | passed | 0.00031 seconds |
28
+ ./spec/webvalve/manager_spec.rb[1:5:2:6] | passed | 0.0002 seconds |
29
+ ./spec/webvalve/manager_spec.rb[1:5:2:7] | passed | 0.00017 seconds |
30
+ ./spec/webvalve/manager_spec.rb[1:5:2:8] | passed | 0.00032 seconds |
31
+ ./spec/webvalve/manager_spec.rb[1:5:3:1:1] | passed | 0.00013 seconds |
32
+ ./spec/webvalve/manager_spec.rb[1:5:3:2:1] | passed | 0.00019 seconds |
33
+ ./spec/webvalve/manager_spec.rb[1:5:3:2:2] | passed | 0.00032 seconds |
34
+ ./spec/webvalve/manager_spec.rb[1:5:3:2:3] | passed | 0.00092 seconds |
35
+ ./spec/webvalve/manager_spec.rb[1:5:4:1] | passed | 0.0002 seconds |
36
+ ./spec/webvalve/manager_spec.rb[1:5:4:2] | passed | 0.00036 seconds |
37
+ ./spec/webvalve/manager_spec.rb[1:6:1:1] | passed | 0.00004 seconds |
38
+ ./spec/webvalve/manager_spec.rb[1:6:1:2] | passed | 0.00012 seconds |
39
+ ./spec/webvalve/manager_spec.rb[1:6:2:1] | passed | 0.00004 seconds |
40
+ ./spec/webvalve/manager_spec.rb[1:6:2:2] | passed | 0.00012 seconds |
41
+ ./spec/webvalve/manager_spec.rb[1:6:2:3] | passed | 0.00004 seconds |
42
+ ./spec/webvalve/manager_spec.rb[1:6:3:1] | passed | 0.00004 seconds |
43
+ ./spec/webvalve/manager_spec.rb[1:6:3:2] | passed | 0.00005 seconds |
44
+ ./spec/webvalve/manager_spec.rb[1:6:3:3] | passed | 0.00006 seconds |
45
+ ./spec/webvalve/manager_spec.rb[1:6:3:4] | passed | 0.00006 seconds |
46
+ ./spec/webvalve/manager_spec.rb[1:6:3:5] | passed | 0.00005 seconds |
47
+ ./spec/webvalve/manager_spec.rb[1:7:1:1] | passed | 0.00004 seconds |
48
+ ./spec/webvalve/manager_spec.rb[1:7:1:2] | passed | 0.00305 seconds |
49
+ ./spec/webvalve/manager_spec.rb[1:7:2:1] | passed | 0.00005 seconds |
50
+ ./spec/webvalve/manager_spec.rb[1:7:2:2] | passed | 0.00014 seconds |
51
+ ./spec/webvalve/manager_spec.rb[1:7:2:3] | passed | 0.00005 seconds |
52
+ ./spec/webvalve/manager_spec.rb[1:7:3:1] | passed | 0.00004 seconds |
53
+ ./spec/webvalve/manager_spec.rb[1:7:3:2] | passed | 0.00008 seconds |
54
+ ./spec/webvalve/manager_spec.rb[1:7:3:3] | passed | 0.00004 seconds |
55
+ ./spec/webvalve/manager_spec.rb[1:7:3:4] | passed | 0.00004 seconds |
56
+ ./spec/webvalve/manager_spec.rb[1:7:3:5] | passed | 0.00004 seconds |
57
+ ./spec/webvalve/manager_spec.rb[1:8:1:1] | passed | 0.00003 seconds |
58
+ ./spec/webvalve/manager_spec.rb[1:8:1:2] | passed | 0.00012 seconds |
59
+ ./spec/webvalve/manager_spec.rb[1:8:2:1] | passed | 0.00004 seconds |
60
+ ./spec/webvalve/manager_spec.rb[1:8:2:2] | passed | 0.00013 seconds |
61
+ ./spec/webvalve/manager_spec.rb[1:8:3:1] | passed | 0.00003 seconds |
62
+ ./spec/webvalve/manager_spec.rb[1:8:3:2] | passed | 0.00005 seconds |
63
+ ./spec/webvalve/manager_spec.rb[1:8:3:3] | passed | 0.00004 seconds |
64
+ ./spec/webvalve/manager_spec.rb[1:8:3:4] | passed | 0.00004 seconds |
65
+ ./spec/webvalve_spec.rb[1:1] | passed | 0.00062 seconds |
66
+ ./spec/webvalve_spec.rb[1:2] | passed | 0.00003 seconds |
67
+ ./spec/webvalve_spec.rb[1:3] | passed | 0.00002 seconds |
68
+ ./spec/webvalve_spec.rb[1:4] | passed | 0.00002 seconds |
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  ENV['RAILS_ENV'] ||= 'test'
2
- require File.expand_path('dummy/config/environment', __dir__) if ENV['BUNDLE_GEMFILE'] =~ /rails/
2
+ require 'bundler'
3
+ Bundler.require :default, :development
4
+ require File.expand_path('dummy/config/application', __dir__) if ENV['BUNDLE_GEMFILE'] =~ /rails/
3
5
  require 'rspec'
4
6
  require 'pry'
5
7
  require 'webvalve'
@@ -0,0 +1,7 @@
1
+ module ::Rails
2
+ class << self
3
+ def root
4
+ @root ||= Pathname.new(Dir.pwd).realpath.join('spec', 'dummy')
5
+ end
6
+ end
7
+ end
@@ -23,7 +23,7 @@ RSpec.describe WebValve::FakeService do
23
23
 
24
24
  describe 'integrated behavior' do
25
25
  after do
26
- WebValve.reset
26
+ WebValve.reset!
27
27
  end
28
28
 
29
29
  context 'when the service is at a root path' do
@@ -141,6 +141,21 @@ RSpec.describe WebValve::Manager do
141
141
  expect { subject.setup }.to raise_error('Invalid config for FakeOtherThing. Already stubbed url http://something.dev')
142
142
  end
143
143
  end
144
+
145
+ it 'does not raise with different HTTP auth patterns' do
146
+ disabled_service = class_double(WebValve::FakeService, name: 'FakeSomething')
147
+ other_disabled_service = class_double(WebValve::FakeService, name: 'FakeOtherThing')
148
+ web_mock_stubble = double(to_rack: true)
149
+ allow(WebMock).to receive(:stub_request).and_return(web_mock_stubble)
150
+
151
+ with_env 'SOMETHING_API_URL' => 'http://user1@something.dev', 'OTHER_THING_API_URL' => 'http://user2@something.dev' do
152
+ subject.register disabled_service.name
153
+ subject.register other_disabled_service.name
154
+
155
+ expect { subject.setup }.to_not raise_error
156
+ expect(WebMock).to have_received(:stub_request).with(:any, %r{\Ahttp://something\.dev}).twice
157
+ end
158
+ end
144
159
  end
145
160
 
146
161
  context 'when WebValve is on and allowing traffic' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webvalve
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Moore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-22 00:00:00.000000000 Z
11
+ date: 2021-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: 5.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4.2'
26
+ version: 5.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sinatra
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -134,6 +134,20 @@ dependencies:
134
134
  - - ">="
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0'
137
+ - !ruby/object:Gem::Dependency
138
+ name: rails
139
+ requirement: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ type: :development
145
+ prerelease: false
146
+ version_requirements: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
137
151
  description: Betterment's library for developing and testing service-oriented apps
138
152
  in isolation with WebMock and Sinatra-based fakes.
139
153
  email:
@@ -160,45 +174,11 @@ files:
160
174
  - lib/webvalve/railtie.rb
161
175
  - lib/webvalve/rspec.rb
162
176
  - lib/webvalve/version.rb
163
- - spec/dummy/README.rdoc
164
- - spec/dummy/Rakefile
165
- - spec/dummy/app/assets/config/manifest.js
166
- - spec/dummy/app/assets/javascripts/application.js
167
- - spec/dummy/app/assets/stylesheets/application.css
168
- - spec/dummy/app/controllers/application_controller.rb
169
- - spec/dummy/app/helpers/application_helper.rb
170
- - spec/dummy/app/views/layouts/application.html.erb
171
- - spec/dummy/bin/bundle
172
- - spec/dummy/bin/rails
173
- - spec/dummy/bin/rake
174
- - spec/dummy/bin/setup
175
- - spec/dummy/config.ru
176
177
  - spec/dummy/config/application.rb
177
- - spec/dummy/config/boot.rb
178
- - spec/dummy/config/database.yml
179
- - spec/dummy/config/environment.rb
180
- - spec/dummy/config/environments/development.rb
181
- - spec/dummy/config/environments/production.rb
182
- - spec/dummy/config/environments/test.rb
183
- - spec/dummy/config/initializers/assets.rb
184
- - spec/dummy/config/initializers/backtrace_silencers.rb
185
- - spec/dummy/config/initializers/cookies_serializer.rb
186
- - spec/dummy/config/initializers/filter_parameter_logging.rb
187
- - spec/dummy/config/initializers/inflections.rb
188
- - spec/dummy/config/initializers/mime_types.rb
189
- - spec/dummy/config/initializers/session_store.rb
190
- - spec/dummy/config/initializers/wrap_parameters.rb
191
- - spec/dummy/config/locales/en.yml
192
- - spec/dummy/config/routes.rb
193
- - spec/dummy/config/secrets.yml
194
- - spec/dummy/log/test.log
195
- - spec/dummy/public/404.html
196
- - spec/dummy/public/422.html
197
- - spec/dummy/public/500.html
198
- - spec/dummy/public/favicon.ico
199
178
  - spec/examples.txt
200
179
  - spec/spec_helper.rb
201
180
  - spec/support/helpers.rb
181
+ - spec/support/rails_root.rb
202
182
  - spec/webvalve/fake_service_config_spec.rb
203
183
  - spec/webvalve/fake_service_spec.rb
204
184
  - spec/webvalve/manager_spec.rb
@@ -206,7 +186,8 @@ files:
206
186
  homepage: https://github.com/Betterment/webvalve
207
187
  licenses:
208
188
  - MIT
209
- metadata: {}
189
+ metadata:
190
+ rubygems_mfa_required: 'true'
210
191
  post_install_message:
211
192
  rdoc_options: []
212
193
  require_paths:
@@ -215,58 +196,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
215
196
  requirements:
216
197
  - - ">="
217
198
  - !ruby/object:Gem::Version
218
- version: '2'
199
+ version: 2.6.0
219
200
  required_rubygems_version: !ruby/object:Gem::Requirement
220
201
  requirements:
221
202
  - - ">="
222
203
  - !ruby/object:Gem::Version
223
204
  version: '0'
224
205
  requirements: []
225
- rubygems_version: 3.1.2
206
+ rubygems_version: 3.1.6
226
207
  signing_key:
227
208
  specification_version: 4
228
209
  summary: A library for faking http service integrations in development and test
229
210
  test_files:
230
211
  - spec/spec_helper.rb
231
- - spec/dummy/app/controllers/application_controller.rb
232
- - spec/dummy/app/views/layouts/application.html.erb
233
- - spec/dummy/app/assets/config/manifest.js
234
- - spec/dummy/app/assets/javascripts/application.js
235
- - spec/dummy/app/assets/stylesheets/application.css
236
- - spec/dummy/app/helpers/application_helper.rb
237
- - spec/dummy/bin/rake
238
- - spec/dummy/bin/setup
239
- - spec/dummy/bin/bundle
240
- - spec/dummy/bin/rails
241
- - spec/dummy/config/secrets.yml
242
- - spec/dummy/config/routes.rb
243
- - spec/dummy/config/locales/en.yml
244
- - spec/dummy/config/environments/production.rb
245
- - spec/dummy/config/environments/development.rb
246
- - spec/dummy/config/environments/test.rb
247
- - spec/dummy/config/environment.rb
248
212
  - spec/dummy/config/application.rb
249
- - spec/dummy/config/database.yml
250
- - spec/dummy/config/boot.rb
251
- - spec/dummy/config/initializers/backtrace_silencers.rb
252
- - spec/dummy/config/initializers/mime_types.rb
253
- - spec/dummy/config/initializers/filter_parameter_logging.rb
254
- - spec/dummy/config/initializers/session_store.rb
255
- - spec/dummy/config/initializers/wrap_parameters.rb
256
- - spec/dummy/config/initializers/assets.rb
257
- - spec/dummy/config/initializers/cookies_serializer.rb
258
- - spec/dummy/config/initializers/inflections.rb
259
- - spec/dummy/config.ru
260
- - spec/dummy/Rakefile
261
- - spec/dummy/public/favicon.ico
262
- - spec/dummy/public/422.html
263
- - spec/dummy/public/500.html
264
- - spec/dummy/public/404.html
265
- - spec/dummy/log/test.log
266
- - spec/dummy/README.rdoc
267
213
  - spec/examples.txt
268
214
  - spec/webvalve/fake_service_spec.rb
269
215
  - spec/webvalve/fake_service_config_spec.rb
270
216
  - spec/webvalve/manager_spec.rb
271
217
  - spec/webvalve_spec.rb
272
218
  - spec/support/helpers.rb
219
+ - spec/support/rails_root.rb
@@ -1,28 +0,0 @@
1
- == README
2
-
3
- This README would normally document whatever steps are necessary to get the
4
- application up and running.
5
-
6
- Things you may want to cover:
7
-
8
- * Ruby version
9
-
10
- * System dependencies
11
-
12
- * Configuration
13
-
14
- * Database creation
15
-
16
- * Database initialization
17
-
18
- * How to run the test suite
19
-
20
- * Services (job queues, cache servers, search engines, etc.)
21
-
22
- * Deployment instructions
23
-
24
- * ...
25
-
26
-
27
- Please feel free to use a different markup language if you do not plan to run
28
- <tt>rake doc:app</tt>.
data/spec/dummy/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
-
6
- Rails.application.load_tasks
@@ -1,3 +0,0 @@
1
- //= link_tree ../images
2
- //= link_directory ../javascripts .js
3
- //= link_directory ../stylesheets .css
@@ -1,13 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require_tree .