stripe-ruby-mock 3.1.0.rc2 → 3.1.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e44063ad0593364e5b9a85f514113c0dd8222e95440410ff9989545e2b947f08
4
- data.tar.gz: 3bb136ecba532f8e6e8078b5eba0c8877876d6cf9a0f9c66cb311fd8271e9242
3
+ metadata.gz: 334d13aee8d09763d8bddf689cfa992de81006364b510887073df7d05a0bf531
4
+ data.tar.gz: 684baff9323adb815a14b6cf94f4c94d5abbbecb5cdf77c5ba3ccce296149741
5
5
  SHA512:
6
- metadata.gz: 36e31f008894062f3678c14158436b50a72699977d14c9419e36b53ca4c22d68d3f2bc5f72fac39abb0adcd01121ae3223b43cc71bc79c54159fcba343131d3e
7
- data.tar.gz: a49ae0d98ffa6560dac087acfeff75ea041c8d63a1703b7e72214321362208ef4b38ef9411f5698022c2fdc1003345e21f1c10e02309a93ce624fbb67f7108e6
6
+ metadata.gz: 1d3a8fd548a29e7dbc7a6190862e70e79594ee43432b68998882628419d715d44a48df2068b8748e0c68c8a6cbb872659fb5952309737a464a585d53389158bc
7
+ data.tar.gz: 1751365b6dbc521d23bff923b7ae91852509b8b8fde41d75824d04fa51213819682749fee56d111a986bf2a4c37f37e0969b3e50f5f8687edfa30d3ee0d1cd18
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 3.1.0.rc3 (pre-release 2021-07-14)
2
+
3
+ - [#785](https://github.com/stripe-ruby-mock/stripe-ruby-mock/pull/785): `Stripe::Product` no longer requires `type`. [@TastyPi](https://github.com/TastyPi)
4
+ - [#784](https://github.com/stripe-ruby-mock/stripe-ruby-mock/pull/784): Fix "Wrong number of arguments" error in tests. [@TastyPi](https://github.com/TastyPi)
5
+ - [#782](https://github.com/stripe-ruby-mock/stripe-ruby-mock/pull/782): Support expanding `setup_intent` in `Stripe::Checkout::Session`. [@TastyPi](https://github.com/TastyPi)
6
+
1
7
  ### 3.1.0.rc2 (pre-release 2021-03-03)
2
8
 
3
9
  - [#767](https://github.com/stripe-ruby-mock/stripe-ruby-mock/pull/767): Fixes tests and more [@lpsBetty](https://github.com/lpsBetty)
@@ -8,7 +8,13 @@ module StripeMock
8
8
 
9
9
  def get_checkout_session(route, method_url, params, headers)
10
10
  route =~ method_url
11
- assert_existence :checkout_session, $1, checkout_sessions[$1]
11
+ checkout_session = assert_existence :checkout_session, $1, checkout_sessions[$1]
12
+
13
+ checkout_session = checkout_session.clone
14
+ if params[:expand]&.include?('setup_intent') && checkout_session[:setup_intent]
15
+ checkout_session[:setup_intent] = setup_intents[checkout_session[:setup_intent]]
16
+ end
17
+ checkout_session
12
18
  end
13
19
  end
14
20
  end
@@ -29,10 +29,6 @@ module StripeMock
29
29
  raise Stripe::InvalidRequestError.new(missing_param_message(k), k) if params[k].nil?
30
30
  end
31
31
 
32
- if !%w[good service].include?(params[:type])
33
- raise Stripe::InvalidRequestError.new("Invalid type: must be one of good or service", :type)
34
- end
35
-
36
32
  if products[ params[:id] ]
37
33
  raise Stripe::InvalidRequestError.new(already_exists_message(Stripe::Product), :id)
38
34
  end
@@ -16,9 +16,9 @@ module StripeMock
16
16
  self.clear_data
17
17
  end
18
18
 
19
- def mock_request(*args)
19
+ def mock_request(*args, **kwargs)
20
20
  begin
21
- @instance.mock_request(*args)
21
+ @instance.mock_request(*args, **kwargs)
22
22
  rescue Stripe::InvalidRequestError => e
23
23
  {
24
24
  :error_raised => 'invalid_request',
@@ -14,7 +14,6 @@ module StripeMock
14
14
  {
15
15
  :id => 'stripe_mock_default_product_id',
16
16
  :name => 'Default Product',
17
- :type => 'service'
18
17
  }.merge(params)
19
18
  end
20
19
 
@@ -1,4 +1,4 @@
1
1
  module StripeMock
2
2
  # stripe-ruby-mock version
3
- VERSION = "3.1.0.rc2"
3
+ VERSION = "3.1.0.rc3"
4
4
  end
@@ -34,5 +34,14 @@ shared_examples 'Checkout API' do
34
34
  expect(e.http_status).to eq(404)
35
35
  }
36
36
  end
37
+
38
+ it 'can expand setup_intent' do
39
+ setup_intent = Stripe::SetupIntent.create
40
+ initial_session = Stripe::Checkout::Session.create(setup_intent: setup_intent.id)
41
+
42
+ checkout_session = Stripe::Checkout::Session.retrieve(id: initial_session.id, expand: ['setup_intent'])
43
+
44
+ expect(checkout_session.setup_intent).to eq(setup_intent)
45
+ end
37
46
  end
38
47
  end
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
3
  shared_examples "Product API" do
4
- let(:product_attributes) { {id: "prod_123", name: "My Mock Product", type: "service"} }
4
+ let(:product_attributes) { {id: "prod_123", name: "My Mock Product"} }
5
5
  let(:product) { Stripe::Product.create(product_attributes) }
6
6
 
7
7
  it "creates a stripe product" do
@@ -101,14 +101,6 @@ shared_examples "Product API" do
101
101
  it("requires a name") { @attribute_name = :name }
102
102
  end
103
103
 
104
- describe "Inclusion" do
105
- it "validates inclusion of type in 'good' or 'service'" do
106
- expect {
107
- Stripe::Product.create(params.merge({type: "OOPS"}))
108
- }.to raise_error(Stripe::InvalidRequestError, "Invalid type: must be one of good or service")
109
- end
110
- end
111
-
112
104
  describe "Uniqueness" do
113
105
  let(:already_exists_message){ stripe_validator.already_exists_message(Stripe::Product) }
114
106
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe-ruby-mock
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.rc2
4
+ version: 3.1.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gilbert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-03 00:00:00.000000000 Z
11
+ date: 2021-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stripe
@@ -316,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
316
316
  - !ruby/object:Gem::Version
317
317
  version: 1.3.1
318
318
  requirements: []
319
- rubygems_version: 3.0.9
319
+ rubygems_version: 3.1.2
320
320
  signing_key:
321
321
  specification_version: 4
322
322
  summary: TDD with stripe