rspec-stripe 0.0.7 → 0.0.8
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 +4 -4
- data/Gemfile.lock +3 -1
- data/lib/rspec-stripe/factories/subscription.rb +2 -2
- data/lib/rspec-stripe/runner.rb +1 -1
- data/rspec-stripe.gemspec +1 -1
- data/spec/runner_spec.rb +11 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0424e51ca2e88f0219aee1005d7af0ca66881eb7
|
4
|
+
data.tar.gz: 5b0dc798e4c4659c7183dfcdfe202cba2194eddd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d0fa1b656d8ae2dffb68268625de57c89b866ff302209bf9f989b63673c2a9bb129c843e6d6e1d9dcec33aa71b9229419c1b7a6c64f5091d3256fe5c4fdc9cb
|
7
|
+
data.tar.gz: 8fb229768efcdd773fa366b7220d7dae1906fdf8b97b249cc0a02ae389258b401fbbdf6898da64a98adca50366e4dd4f309e123cb3ba0c84f9eca715bcc6897c
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module RSpecStripe::Factory
|
2
|
-
Subscription = Struct.new(:id, :customer) do
|
2
|
+
Subscription = Struct.new(:id, :customer, :metadata) do
|
3
3
|
def get
|
4
4
|
@get ||= begin
|
5
|
-
customer.subscriptions.create(plan: id)
|
5
|
+
customer.subscriptions.create(plan: id, metadata: metadata)
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
data/lib/rspec-stripe/runner.rb
CHANGED
@@ -35,7 +35,7 @@ module RSpecStripe
|
|
35
35
|
|
36
36
|
def subscription_factory
|
37
37
|
raise "No customer given" unless customer
|
38
|
-
@subscription_factory ||= RSpecStripe::Factory::Subscription.new(recipes[:subscription], customer)
|
38
|
+
@subscription_factory ||= RSpecStripe::Factory::Subscription.new(recipes[:subscription], customer, recipes.fetch(:subscription_metadata, {}))
|
39
39
|
end
|
40
40
|
|
41
41
|
def card_factory
|
data/rspec-stripe.gemspec
CHANGED
data/spec/runner_spec.rb
CHANGED
@@ -145,11 +145,12 @@ describe RSpecStripe::Runner do
|
|
145
145
|
|
146
146
|
context "with a customer" do
|
147
147
|
let(:customer_double) { double(Stripe::Customer, id: "id") }
|
148
|
+
let(:expected_params) { { plan: "test", metadata: {} } }
|
148
149
|
before(:each) {
|
149
150
|
expect(Stripe::Customer).to receive(:retrieve).once { customer_double }
|
150
151
|
expect(customer_double).to receive(:subscriptions).once {
|
151
152
|
stub = double("subscriptions")
|
152
|
-
expect(stub).to receive(:create).once.with(
|
153
|
+
expect(stub).to receive(:create).once.with(expected_params)
|
153
154
|
stub
|
154
155
|
}
|
155
156
|
}
|
@@ -161,6 +162,15 @@ describe RSpecStripe::Runner do
|
|
161
162
|
runner = RSpecStripe::Runner.new({customer: "id", subscription: "test"})
|
162
163
|
runner.call!
|
163
164
|
end
|
165
|
+
|
166
|
+
context "with subscription_metadata" do
|
167
|
+
let!(:expected_params) { { plan: "test", metadata: { a: "test" }} }
|
168
|
+
|
169
|
+
it "creates the specified metadata subscription" do
|
170
|
+
runner = RSpecStripe::Runner.new({customer: "id", subscription: "test", subscription_metadata: { a: "test" }})
|
171
|
+
runner.call!
|
172
|
+
end
|
173
|
+
end
|
164
174
|
end
|
165
175
|
end
|
166
176
|
end
|