stripe-ruby-mock 1.8.4.8 → 1.8.4.9
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# stripe-ruby-mock
|
2
2
|
|
3
|
-
* Homepage: https://github.com/
|
4
|
-
* Issues: https://github.com/
|
3
|
+
* Homepage: https://github.com/rebelidealist/stripe-ruby-mock
|
4
|
+
* Issues: https://github.com/rebelidealist/stripe-ruby-mock/issues
|
5
5
|
|
6
6
|
## Install
|
7
7
|
|
8
8
|
In your gemfile:
|
9
9
|
|
10
|
-
gem 'stripe-ruby-mock', '>= 1.8.4.
|
10
|
+
gem 'stripe-ruby-mock', '>= 1.8.4.9'
|
11
11
|
|
12
12
|
## Features
|
13
13
|
|
data/lib/stripe_mock/data.rb
CHANGED
@@ -57,7 +57,7 @@ module StripeMock
|
|
57
57
|
address_line1_check: nil,
|
58
58
|
address_zip_check: nil
|
59
59
|
},
|
60
|
-
captured: params.has_key?(:capture) ? params
|
60
|
+
captured: params.has_key?(:capture) ? params.delete(:capture) : true,
|
61
61
|
failure_message: nil,
|
62
62
|
amount_refunded: 0,
|
63
63
|
customer: nil,
|
@@ -3,8 +3,9 @@ module StripeMock
|
|
3
3
|
module Charges
|
4
4
|
|
5
5
|
def Charges.included(klass)
|
6
|
-
klass.add_handler 'post /v1/charges',
|
7
|
-
klass.add_handler 'get /v1/charges/(.*)',
|
6
|
+
klass.add_handler 'post /v1/charges', :new_charge
|
7
|
+
klass.add_handler 'get /v1/charges/(.*)', :get_charge
|
8
|
+
klass.add_handler 'post /v1/charges/(.*)/capture', :capture_charge
|
8
9
|
end
|
9
10
|
|
10
11
|
def new_charge(route, method_url, params, headers)
|
@@ -18,6 +19,15 @@ module StripeMock
|
|
18
19
|
charges[$1] ||= Data.mock_charge(:id => $1)
|
19
20
|
end
|
20
21
|
|
22
|
+
def capture_charge(route, method_url, params, headers)
|
23
|
+
route =~ method_url
|
24
|
+
charge = charges[$1]
|
25
|
+
assert_existance :charge, $1, charge
|
26
|
+
|
27
|
+
charge[:captured] = true
|
28
|
+
charge
|
29
|
+
end
|
30
|
+
|
21
31
|
end
|
22
32
|
end
|
23
33
|
end
|
data/lib/stripe_mock/version.rb
CHANGED
@@ -13,6 +13,7 @@ shared_examples 'Charge API' do
|
|
13
13
|
expect(charge.id).to match(/^test_ch/)
|
14
14
|
expect(charge.amount).to eq(999)
|
15
15
|
expect(charge.description).to eq('card charge')
|
16
|
+
expect(charge.captured).to eq(true)
|
16
17
|
end
|
17
18
|
|
18
19
|
|
@@ -104,4 +105,19 @@ shared_examples 'Charge API' do
|
|
104
105
|
end
|
105
106
|
end
|
106
107
|
|
108
|
+
describe "two-step charge (auth, then capture)" do
|
109
|
+
it "changes captured status upon #capture" do
|
110
|
+
charge = Stripe::Charge.create({
|
111
|
+
amount: 777,
|
112
|
+
currency: 'USD',
|
113
|
+
card: 'card_token_abc',
|
114
|
+
capture: false
|
115
|
+
})
|
116
|
+
|
117
|
+
returned_charge = charge.capture
|
118
|
+
expect(charge.captured).to be_true
|
119
|
+
expect(returned_charge.id).to eq(charge.id)
|
120
|
+
expect(returned_charge.captured).to be_true
|
121
|
+
end
|
122
|
+
end
|
107
123
|
end
|
data/stripe-ruby-mock.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.license = "MIT"
|
11
11
|
gem.authors = ["Gilbert"]
|
12
12
|
gem.email = "gilbertbgarza@gmail.com"
|
13
|
-
gem.homepage = "https://github.com/
|
13
|
+
gem.homepage = "https://github.com/rebelidealist/stripe-ruby-mock"
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe-ruby-mock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.4.
|
4
|
+
version: 1.8.4.9
|
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: 2013-08-
|
12
|
+
date: 2013-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: stripe
|
@@ -201,7 +201,7 @@ files:
|
|
201
201
|
- spec/util_spec.rb
|
202
202
|
- spec/webhook_spec.rb
|
203
203
|
- stripe-ruby-mock.gemspec
|
204
|
-
homepage: https://github.com/
|
204
|
+
homepage: https://github.com/rebelidealist/stripe-ruby-mock
|
205
205
|
licenses:
|
206
206
|
- MIT
|
207
207
|
post_install_message:
|