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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e18f4755b49b956d0e5abd733989f3feedd348b3
4
- data.tar.gz: da11b405e0ca016dc7be52304163fc8587b8f029
2
+ SHA256:
3
+ metadata.gz: 37b6c047ab472cc0e240f78a2fe4998b5a5eb7b1316e2ee16eebe0e335db2986
4
+ data.tar.gz: ad505a2fd476b71972bce1426f7235b2f5e6577a258a696771c1fb105b744063
5
5
  SHA512:
6
- metadata.gz: 3872c222ed0500c93392ab1d59b6f50372936d8f9f0d057c7f06b6d063e62cc4275b05216cd43faed9cd6b3a9278ce6a7c0813cecaa732710cbfdd51d2264cd3
7
- data.tar.gz: ccba571c511e97061fbc4211f797d0dbf3f207955f3c001501fa3086371c6fd80643c2e3922b8eb6ffcfb582b600f1b71bb20774f92a4a21e5d4b7e54d0512f3
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
@@ -4,9 +4,10 @@ sudo: false
4
4
  rvm:
5
5
  - 2.0.0
6
6
  - 2.1.1
7
+ - 2.2.3
8
+ - 2.5.1
7
9
  - jruby
8
10
 
9
11
  gemfile:
10
- - gemfiles/am40.gemfile
11
12
  - gemfiles/am41.gemfile
12
- - gemfiles/am42.gemfile
13
+ - gemfiles/am42.gemfile
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
- raise ::Subroutine::Failure.new(self)
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
@@ -2,7 +2,7 @@ module Subroutine
2
2
 
3
3
  MAJOR = 0
4
4
  MINOR = 6
5
- PATCH = 2
5
+ PATCH = 3
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
@@ -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/mini_test'
6
+ require 'mocha/minitest'
7
7
 
8
8
  Minitest::Reporters.use!([Minitest::Reporters::DefaultReporter.new])
9
9
 
10
- class TestCase < (MiniTest::Unit::TestCase rescue ::MiniTest::Test); end
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.2
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-07-11 00:00:00.000000000 Z
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.6.8
155
+ rubygems_version: 2.7.7
154
156
  signing_key:
155
157
  specification_version: 4
156
158
  summary: Feature-driven operation objects.