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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c3a6e7f3c2add26009fa2ae2c9ff51571b157b9
4
- data.tar.gz: c1101cb7f96e805a364da4111030f740e4772465
3
+ metadata.gz: 0424e51ca2e88f0219aee1005d7af0ca66881eb7
4
+ data.tar.gz: 5b0dc798e4c4659c7183dfcdfe202cba2194eddd
5
5
  SHA512:
6
- metadata.gz: 21b61f4c70459213ea664766715e074d40e6f3a519286167f05f3d927d527f3fa914b9efa2750a9043aefd21aa7bb9518edd3807f9d85f336e491f19a1483839
7
- data.tar.gz: 87ab6979e568409da962e62325267269b6cffad66e163759db994484af80f2dfc6d8abd087be645915c1bad6aaf053e83c02d2f887b97cb3d396d69d6faf1fbb
6
+ metadata.gz: 1d0fa1b656d8ae2dffb68268625de57c89b866ff302209bf9f989b63673c2a9bb129c843e6d6e1d9dcec33aa71b9229419c1b7a6c64f5091d3256fe5c4fdc9cb
7
+ data.tar.gz: 8fb229768efcdd773fa366b7220d7dae1906fdf8b97b249cc0a02ae389258b401fbbdf6898da64a98adca50366e4dd4f309e123cb3ba0c84f9eca715bcc6897c
@@ -10,7 +10,6 @@ GIT
10
10
  PATH
11
11
  remote: .
12
12
  specs:
13
- rspec-stripe (0.0.6)
14
13
 
15
14
  GEM
16
15
  remote: https://rubygems.org/
@@ -46,3 +45,6 @@ DEPENDENCIES
46
45
  rspec (~> 3.1)
47
46
  rspec-stripe!
48
47
  stripe!
48
+
49
+ BUNDLED WITH
50
+ 1.10.4
@@ -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
 
@@ -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
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.require_paths = ["lib"]
13
13
  s.files = `git ls-files`.split("\n")
14
14
 
15
- s.version = "0.0.7"
15
+ s.version = "0.0.8"
16
16
  s.required_ruby_version = '>= 2.0.0'
17
17
  s.required_rubygems_version = '>= 1.6.2'
18
18
  end
@@ -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(plan: "test")
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Bussey