balanced 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,7 +25,12 @@ module Balanced
25
25
  #
26
26
  def void
27
27
  self.is_void = true
28
- save
28
+ begin
29
+ save
30
+ rescue Balanced::Error
31
+ self.is_void = false
32
+ raise
33
+ end
29
34
  end
30
35
 
31
36
  # Captures a valid Hold and returns a Debit representing the transfer of
@@ -1,3 +1,3 @@
1
1
  module Balanced
2
- VERSION = '0.3.6'
2
+ VERSION = '0.3.7'
3
3
  end
@@ -33,7 +33,23 @@ describe Balanced::Hold do
33
33
 
34
34
  subject { @hold.is_void }
35
35
  it { should be_true }
36
- end
36
+ end
37
+
38
+ describe 'when exception is thrown' do
39
+ use_vcr_cassette
40
+ before do
41
+ @hold = @buyer.hold 150
42
+ @debit = @hold.capture
43
+ end
44
+
45
+ it "should not change void state since its captured" do
46
+ lambda { @hold.void }.should raise_error(Balanced::Conflict)
47
+ @hold.is_void.should be_false
48
+ end
49
+ # void here.
50
+
51
+
52
+ end
37
53
 
38
54
  end
39
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: balanced
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-06 00:00:00.000000000 Z
12
+ date: 2012-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday