subroutine 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -2
- data/lib/subroutine/op.rb +2 -1
- data/lib/subroutine/version.rb +1 -1
- data/test/subroutine/base_test.rb +13 -0
- data/test/support/ops.rb +27 -0
- data/test/test_helper.rb +2 -2
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 37b6c047ab472cc0e240f78a2fe4998b5a5eb7b1316e2ee16eebe0e335db2986
|
4
|
+
data.tar.gz: ad505a2fd476b71972bce1426f7235b2f5e6577a258a696771c1fb105b744063
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b05231e05c2e1eb6153f489b25e24b5499d2bf6fdb2ef7cbd2e814dc3ffa50f50966d49fb21f3a0b71158856574e89fab59a01b330d76152767a084b7622877
|
7
|
+
data.tar.gz: dbde52dda2095ee0f29b7c7ca35e5305d45e698120ed2f0d3ffd51612e8cf21bf9bd0b82fa1a1d1dfcae708bf3e4a337856108d554d096d6c42253828b73fe1c
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
subroutine
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.1
|
data/.travis.yml
CHANGED
data/lib/subroutine/op.rb
CHANGED
@@ -187,7 +187,8 @@ module Subroutine
|
|
187
187
|
rescue Exception => e
|
188
188
|
if e.respond_to?(:record)
|
189
189
|
inherit_errors(e.record) unless e.record == self
|
190
|
-
|
190
|
+
new_e = ::Subroutine::Failure.new(self)
|
191
|
+
raise new_e, new_e.message, e.backtrace
|
191
192
|
else
|
192
193
|
raise
|
193
194
|
end
|
data/lib/subroutine/version.rb
CHANGED
@@ -266,5 +266,18 @@ module Subroutine
|
|
266
266
|
refute op.submit
|
267
267
|
end
|
268
268
|
|
269
|
+
def test_it_does_not_omit_the_backtrace_from_the_original_error
|
270
|
+
op = ::ErrorTraceOp.new
|
271
|
+
begin
|
272
|
+
op.submit!
|
273
|
+
rescue Exception => e
|
274
|
+
found = e.backtrace.detect do |msg|
|
275
|
+
msg =~ /test\/support\/ops\.rb:[\d]+.+foo/
|
276
|
+
end
|
277
|
+
|
278
|
+
refute_nil found, "Expected backtrace to include original caller of foo"
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
269
282
|
end
|
270
283
|
end
|
data/test/support/ops.rb
CHANGED
@@ -273,3 +273,30 @@ class NoOutputNoSuccessOp < ::Subroutine::Op
|
|
273
273
|
errors.add(:foo, "bar")
|
274
274
|
end
|
275
275
|
end
|
276
|
+
|
277
|
+
class ErrorTraceOp < ::Subroutine::Op
|
278
|
+
|
279
|
+
class SomeObject
|
280
|
+
include ::ActiveModel::Model
|
281
|
+
include ::ActiveModel::Validations::Callbacks
|
282
|
+
|
283
|
+
def foo
|
284
|
+
errors.add(:base, "Failure of things")
|
285
|
+
raise Subroutine::Failure.new(self)
|
286
|
+
end
|
287
|
+
|
288
|
+
def bar
|
289
|
+
foo
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
class SubOp < ::Subroutine::Op
|
294
|
+
def perform
|
295
|
+
SomeObject.new.bar
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
def perform
|
300
|
+
SubOp.submit!
|
301
|
+
end
|
302
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -3,10 +3,10 @@ require 'minitest/autorun'
|
|
3
3
|
require 'minitest/unit'
|
4
4
|
|
5
5
|
require 'minitest/reporters'
|
6
|
-
require 'mocha/
|
6
|
+
require 'mocha/minitest'
|
7
7
|
|
8
8
|
Minitest::Reporters.use!([Minitest::Reporters::DefaultReporter.new])
|
9
9
|
|
10
|
-
class TestCase <
|
10
|
+
class TestCase < ::Minitest::Test; end
|
11
11
|
|
12
12
|
require_relative 'support/ops'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: subroutine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Nelson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -102,6 +102,8 @@ extensions: []
|
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
104
|
- ".gitignore"
|
105
|
+
- ".ruby-gemset"
|
106
|
+
- ".ruby-version"
|
105
107
|
- ".travis.yml"
|
106
108
|
- Gemfile
|
107
109
|
- LICENSE.txt
|
@@ -150,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
152
|
version: '0'
|
151
153
|
requirements: []
|
152
154
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.
|
155
|
+
rubygems_version: 2.7.7
|
154
156
|
signing_key:
|
155
157
|
specification_version: 4
|
156
158
|
summary: Feature-driven operation objects.
|