stoplight 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ec8f5b8b13778f792ad1fbbbc3138229ef51ac4e62149f93eb3a8b4bccc9d3a
4
- data.tar.gz: d93e27dbf0563bb30a7025bf646befe712269c4bd5f259432ffeeb8c680934da
3
+ metadata.gz: bbfed26c7b63f56e88cd970d5db820022a89d689570cd4e98168b7226d718791
4
+ data.tar.gz: 9206b2c2a66e78d39f37e7932fc95faaf850a2cc54d024eab2a2d90dc14396b4
5
5
  SHA512:
6
- metadata.gz: c3c10ff2886343b2625c777c5143656624df7591ab75e3bb8c8c43032fc10a92dacd9f2a801eebd7c636c5adc5a744525be76cb22f4acb4f839f6a87a6f8608b
7
- data.tar.gz: 28af6a4a57af91a6d21df0b79909a4584acca9e5028079aff313911a965d3cb1da36b3a0b9c934b8621b6bd372e84da34d1fa47b47c043c10e27bb99a885c6f9
6
+ metadata.gz: 34d477b3b8e0c6e9b34a0a1ea7e0e6fab4950601d914407063a113f019b9e4a7420b4b291f76702e326b41f3b7cd780adb55f9c2df28bd659c9be7d384af35b4
7
+ data.tar.gz: ab49c8f6cac59358b78807fa82e88e8ee3cec5c668dad2f6cc0ca8183507dc64373f611c23b83dce4d2d5958f176d6c447e796a9137e87a165b0cabd12b7dc7c
@@ -52,7 +52,18 @@ module Stoplight
52
52
  fallback.call(nil)
53
53
  end
54
54
 
55
+ MISSING_BLOCK_ERROR = <<~ERROR
56
+ Oops! An error occurred while executing the `Stoplight#run` method. This happened because you
57
+ didn't pass a code block to the `Stoplight()` function. You can fix this issue this way:
58
+
59
+ Stoplight('test-light') { ... }.run
60
+
61
+ For more details and examples, please refer to the documentation https://github.com/bolshakov/stoplight/tree/release/v3.x
62
+ ERROR
63
+
55
64
  def run_code(on_success, on_failure)
65
+ raise ArgumentError, MISSING_BLOCK_ERROR unless code
66
+
56
67
  result = code.call
57
68
  failures = clear_failures
58
69
  on_success&.call(failures)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stoplight
4
- VERSION = Gem::Version.new('3.0.1')
4
+ VERSION = Gem::Version.new('3.0.2')
5
5
  end
@@ -285,5 +285,13 @@ RSpec.describe Stoplight::Light::Runnable do
285
285
  end
286
286
  end
287
287
  end
288
+
289
+ context 'when the code block is missing' do
290
+ subject { Stoplight::Light.new(name) }
291
+
292
+ it 'raises an ArgumentError error' do
293
+ expect { subject.run }.to raise_error(ArgumentError)
294
+ end
295
+ end
288
296
  end
289
297
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stoplight
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Desautels
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-12-01 00:00:00.000000000 Z
13
+ date: 2023-08-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: redlock