stripe-ruby-mock 1.10.1.3 → 1.10.1.4

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.
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  In your gemfile:
10
10
 
11
- gem 'stripe-ruby-mock', '~> 1.10.1.3'
11
+ gem 'stripe-ruby-mock', '~> 1.10.1.4'
12
12
 
13
13
  ## Features
14
14
 
@@ -12,6 +12,11 @@ module StripeMock
12
12
 
13
13
  def new_charge(route, method_url, params, headers)
14
14
  id = new_id('ch')
15
+
16
+ if params[:card] && params[:card].is_a?(String)
17
+ params[:card] = get_card_by_token(params[:card])
18
+ end
19
+
15
20
  charges[id] = Data.mock_charge(params.merge :id => id)
16
21
  end
17
22
 
@@ -1,4 +1,4 @@
1
1
  module StripeMock
2
2
  # stripe-ruby-mock version
3
- VERSION = "1.10.1.3"
3
+ VERSION = "1.10.1.4"
4
4
  end
@@ -4,6 +4,16 @@ shared_examples 'Card Token Mocking' do
4
4
 
5
5
  describe 'Direct Token Creation' do
6
6
 
7
+ it "generates and reads a card token for create charge" do
8
+ card_token = StripeMock.generate_card_token(last4: "2244", exp_month: 33, exp_year: 2255)
9
+
10
+ charge = Stripe::Charge.create(amount: 500, card: card_token)
11
+ card = charge.card
12
+ expect(card.last4).to eq("2244")
13
+ expect(card.exp_month).to eq(33)
14
+ expect(card.exp_year).to eq(2255)
15
+ end
16
+
7
17
  it "generates and reads a card token for create customer" do
8
18
  card_token = StripeMock.generate_card_token(last4: "9191", exp_month: 99, exp_year: 3005)
9
19
 
@@ -14,7 +24,7 @@ shared_examples 'Card Token Mocking' do
14
24
  expect(card.exp_year).to eq(3005)
15
25
  end
16
26
 
17
- it "generated and reads a card token for update customer" do
27
+ it "generates and reads a card token for update customer" do
18
28
  card_token = StripeMock.generate_card_token(last4: "1133", exp_month: 11, exp_year: 2099)
19
29
 
20
30
  cus = Stripe::Customer.create()
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.10.1.3
4
+ version: 1.10.1.4
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: 2014-03-13 00:00:00.000000000 Z
12
+ date: 2014-03-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: stripe