ruby_valve 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d7b2f4de1638c09da9c95d2c18ffe1f84e0c0ff5
4
- data.tar.gz: ec03254b2ccb35abc87a5f147a0583f3ad7cdce6
3
+ metadata.gz: 7b8f2c19f9c27eb98876a7d17762a72bd3aabe6e
4
+ data.tar.gz: c2464b0627d5b46a1258483ebf08de8ebc43af9c
5
5
  SHA512:
6
- metadata.gz: 3a21595eeb9fd52ff4ca46017adcbf5c018c52188f34a9dbea04b256e20785e8693255625c620d1dee55cf59a047ba54402f669266195a788619b28eb420f712
7
- data.tar.gz: 2ac42dbffe38ae921ef4e79d58d278f36ff6c0c2bf797b6d82582771a56bea55f96f94e314c7582e88801aeb1c1e2abe3748e01fa8fb0cf35441d02affb3fd5a
6
+ metadata.gz: 89314afbeab98957cc74e86902ab0a051c7ced0e416a77fbcd6082640e4f56231a9a7f243888fccad362ea2e7934dbba60dea990af0a0b4e0508e8c32dec101a
7
+ data.tar.gz: 74242411a418b50dfb041d65fd52ded3d352271820d1ab1ad8de21bea27bdc3b904105c5e8479f8d6864371c45fc6d829709cea25b088fbd969e267a9d4e391b
data/README.md CHANGED
@@ -264,8 +264,8 @@ Executes if an abort, without a raise, was triggered.
264
264
 
265
265
  aborted!
266
266
 
267
- ####\#after_raise and #exeception
268
- Creating an after_raise method will trigger an automatic rescue when an error is raised. The exception is stored in the **exception** method.
267
+ ####\#after_exception and #exception
268
+ Creating an after_exception method will trigger an automatic rescue when an error is raised. The exception is stored in the **exception** method.
269
269
 
270
270
  def step_1
271
271
  abort "call it off", raise: true
@@ -275,7 +275,7 @@ Creating an after_raise method will trigger an automatic rescue when an error is
275
275
  puts "E"
276
276
  end
277
277
 
278
- def after_raise
278
+ def after_exception
279
279
  puts exception.message
280
280
  end
281
281
 
@@ -325,7 +325,7 @@ This will display each step and callback method that was executed.
325
325
 
326
326
  foo = Foo.new
327
327
  foo.execute
328
- foo.executed_steps
328
+ foo.executed
329
329
 
330
330
  [:step_1, :after_each, :step_2, :after_each]
331
331
 
@@ -1,3 +1,3 @@
1
1
  module RubyValve
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -294,5 +294,49 @@ describe RubyValve::Base do
294
294
  end
295
295
  end
296
296
 
297
+ describe "#after_exception" do
298
+ before(:each) do
299
+
300
+ class AfterRaise < RubyValve::Base
301
+ define_method(:after_exception) {}
302
+ define_method(:step_1) {skip :step_2}
303
+ define_method(:step_2) {}
304
+ define_method(:step_3) {abort "Ug", :raise => true}
305
+ define_method(:step_4) {}
306
+ define_method(:step_5) {}
297
307
 
308
+ end
309
+
310
+ @after_raise = AfterRaise.new
311
+ end
312
+
313
+ it "should not raise AbortError when :raise => true" do
314
+ expect {@after_raise.execute}.to_not raise_error
315
+ end
316
+
317
+ end
318
+
319
+ describe "#exception" do
320
+ before(:each) do
321
+
322
+ class AfterRaise < RubyValve::Base
323
+ define_method(:after_exception) {}
324
+ define_method(:step_1) {skip :step_2}
325
+ define_method(:step_2) {}
326
+ define_method(:step_3) {abort "Ug", :raise => true}
327
+ define_method(:step_4) {}
328
+ define_method(:step_5) {}
329
+
330
+ end
331
+
332
+ @after_raise = AfterRaise.new
333
+ end
334
+
335
+ it "should contain the raised exception" do
336
+ @after_raise.execute
337
+ @after_raise.exception.should be_a_kind_of(RubyValve::AbortError)
338
+ @after_raise.exception.message.should eql("Ug")
339
+ end
340
+
341
+ end
298
342
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_valve
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - monochromicorn