stripe 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ require File.expand_path('../../test_helper', __FILE__)
2
2
 
3
3
  module Stripe
4
4
  class CustomerCardTest < Test::Unit::TestCase
5
- FIXTURE = API_FIXTURES.fetch(:source)
5
+ FIXTURE = API_FIXTURES.fetch(:card)
6
6
 
7
7
  setup do
8
8
  @customer =
@@ -16,7 +16,7 @@ module Stripe
16
16
  token: API_FIXTURES.fetch(:token)[:id]
17
17
  )
18
18
  assert_requested :post, "#{Stripe.api_base}/v1/sources"
19
- assert source.kind_of?(Stripe::Card)
19
+ assert source.kind_of?(Stripe::Source)
20
20
  end
21
21
 
22
22
  should "be saveable" do
@@ -29,7 +29,31 @@ module Stripe
29
29
  should "be updateable" do
30
30
  source = Stripe::Source.update(FIXTURE[:id], metadata: {foo: 'bar'})
31
31
  assert_requested :post, "#{Stripe.api_base}/v1/sources/#{FIXTURE[:id]}"
32
- assert source.kind_of?(Stripe::Card)
32
+ assert source.kind_of?(Stripe::Source)
33
+ end
34
+
35
+ context "#delete" do
36
+ should "not be deletable when unattached" do
37
+ source = Stripe::Source.retrieve(FIXTURE[:id])
38
+
39
+ assert_raises NotImplementedError do
40
+ source.delete
41
+ end
42
+ end
43
+
44
+ should "be deletable when attached to a customer" do
45
+ customer_id = API_FIXTURES.fetch(:customer)[:id]
46
+ source = Stripe::Source.construct_from(FIXTURE.merge(customer: customer_id))
47
+ stub_request(:delete, "#{Stripe.api_base}/v1/customers/#{customer_id}/sources/#{FIXTURE[:id]}").
48
+ to_return(body: JSON.generate(FIXTURE))
49
+ assert source.kind_of?(Stripe::Source)
50
+ end
51
+ end
52
+
53
+ should 'not be listable' do
54
+ assert_raises NoMethodError do
55
+ Stripe::Source.list
56
+ end
33
57
  end
34
58
 
35
59
  context "#verify" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-16 00:00:00.000000000 Z
11
+ date: 2017-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday