braintree-rails 1.3.0 → 1.4.0
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/.travis.yml +2 -1
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +48 -34
- data/braintree-rails.gemspec +7 -7
- data/lib/braintree_rails/address.rb +1 -1
- data/lib/braintree_rails/address_validator.rb +1 -1
- data/lib/braintree_rails/api_error.rb +1 -1
- data/lib/braintree_rails/billing_address.rb +5 -1
- data/lib/braintree_rails/business_details.rb +1 -1
- data/lib/braintree_rails/credit_card.rb +2 -2
- data/lib/braintree_rails/customer.rb +2 -2
- data/lib/braintree_rails/individual_details.rb +1 -1
- data/lib/braintree_rails/merchant_account.rb +6 -2
- data/lib/braintree_rails/model.rb +7 -9
- data/lib/braintree_rails/persistence.rb +2 -20
- data/lib/braintree_rails/shipping_address.rb +5 -1
- data/lib/braintree_rails/transaction.rb +5 -5
- data/lib/braintree_rails/transaction_validator.rb +1 -1
- data/lib/braintree_rails/validator.rb +1 -1
- data/lib/braintree_rails/version.rb +1 -1
- data/spec/fixtures/merchant_account.xml +1 -1
- data/spec/fixtures/transaction_error.xml +65 -20
- data/spec/integration/braintree_rails/address_integration_spec.rb +6 -6
- data/spec/integration/braintree_rails/credit_card_integration_spec.rb +17 -17
- data/spec/integration/braintree_rails/customer_integration_spec.rb +17 -17
- data/spec/integration/braintree_rails/merchant_account_integration_spec.rb +11 -11
- data/spec/integration/braintree_rails/transaction_integration_spec.rb +24 -25
- data/spec/integration/integration_spec_helper.rb +2 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/helper.rb +16 -2
- data/spec/unit/braintree_rails/add_on_spec.rb +10 -11
- data/spec/unit/braintree_rails/add_ons_spec.rb +3 -3
- data/spec/unit/braintree_rails/address_details_spec.rb +3 -3
- data/spec/unit/braintree_rails/address_spec.rb +26 -26
- data/spec/unit/braintree_rails/addresses_spec.rb +7 -7
- data/spec/unit/braintree_rails/business_details_spec.rb +8 -8
- data/spec/unit/braintree_rails/configuration_spec.rb +6 -6
- data/spec/unit/braintree_rails/credit_card_spec.rb +76 -76
- data/spec/unit/braintree_rails/credit_cards_spec.rb +11 -11
- data/spec/unit/braintree_rails/customer_spec.rb +44 -44
- data/spec/unit/braintree_rails/discount_spec.rb +10 -11
- data/spec/unit/braintree_rails/discounts_spec.rb +3 -3
- data/spec/unit/braintree_rails/funding_details_spec.rb +12 -12
- data/spec/unit/braintree_rails/individual_details_spec.rb +5 -5
- data/spec/unit/braintree_rails/luhn_10_validator_spec.rb +5 -5
- data/spec/unit/braintree_rails/merchant_account_spec.rb +14 -14
- data/spec/unit/braintree_rails/plan_spec.rb +12 -12
- data/spec/unit/braintree_rails/subscription_spec.rb +53 -53
- data/spec/unit/braintree_rails/subscriptions_spec.rb +4 -5
- data/spec/unit/braintree_rails/transaction_spec.rb +67 -55
- data/spec/unit/braintree_rails/transactions_spec.rb +9 -9
- data/spec/unit/braintree_rails/validation_error_spec.rb +4 -4
- data/spec/unit/braintree_rails/validator_spec.rb +7 -7
- metadata +35 -17
@@ -4,7 +4,7 @@ describe BraintreeRails::Transactions do
|
|
4
4
|
|
5
5
|
before do
|
6
6
|
stub_braintree_request(:get, '/customers/customer_id', :body => fixture('customer.xml'))
|
7
|
-
stub_braintree_request(:get, '/payment_methods/credit_card_id', :body => fixture('credit_card.xml'))
|
7
|
+
stub_braintree_request(:get, '/payment_methods/credit_card/credit_card_id', :body => fixture('credit_card.xml'))
|
8
8
|
end
|
9
9
|
|
10
10
|
describe '#initialize' do
|
@@ -19,7 +19,7 @@ describe BraintreeRails::Transactions do
|
|
19
19
|
|
20
20
|
transactions = BraintreeRails::Transactions.new(BraintreeRails::Customer.new('customer_id'))
|
21
21
|
|
22
|
-
transactions.map(&:id).sort.
|
22
|
+
expect(transactions.map(&:id).sort).to eq(braintree_transactions.map(&:id).sort)
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should load all transactions' do
|
@@ -28,7 +28,7 @@ describe BraintreeRails::Transactions do
|
|
28
28
|
|
29
29
|
braintree_transactions = Braintree::Transaction.search
|
30
30
|
transactions = BraintreeRails::Transactions.new(nil)
|
31
|
-
transactions.map(&:id).sort.
|
31
|
+
expect(transactions.map(&:id).sort).to eq(braintree_transactions.map(&:id).sort)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -39,21 +39,21 @@ describe BraintreeRails::Transactions do
|
|
39
39
|
customer = BraintreeRails::Customer.new('customer_id')
|
40
40
|
transactions = BraintreeRails::Transactions.new(customer)
|
41
41
|
transaction = transactions.build
|
42
|
-
transaction.customer.
|
43
|
-
transaction.credit_card.
|
42
|
+
expect(transaction.customer).to eq(customer)
|
43
|
+
expect(transaction.credit_card).to eq(customer.credit_cards.find(&:default?))
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'has no default options when loading all' do
|
47
47
|
transactions = BraintreeRails::Transactions.new(nil)
|
48
48
|
transaction = transactions.build
|
49
|
-
transaction.attributes.except(:type).values.compact.
|
49
|
+
expect(transaction.attributes.except(:type).values.compact).to be_empty
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'should be able to override default values' do
|
53
53
|
transactions = BraintreeRails::Transactions.new(BraintreeRails::Customer.new('customer_id'))
|
54
54
|
customer = BraintreeRails::Customer.new(:first_name => 'Braintree')
|
55
55
|
transaction = transactions.build(:customer => customer)
|
56
|
-
transaction.customer.
|
56
|
+
expect(transaction.customer).to eq(customer)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -67,7 +67,7 @@ describe BraintreeRails::Transactions do
|
|
67
67
|
stub_braintree_request(:post, '/transactions/advanced_search_ids', :body => fixture('transaction_ids.xml'))
|
68
68
|
stub_braintree_request(:post, '/transactions/advanced_search', :body => fixture('transactions.xml'))
|
69
69
|
|
70
|
-
transactions.find('transactionid').
|
70
|
+
expect(transactions.find('transactionid')).to_not be_blank
|
71
71
|
end
|
72
72
|
end
|
73
|
-
end
|
73
|
+
end
|
@@ -3,21 +3,21 @@ require File.expand_path(File.join(File.dirname(__FILE__), '../unit_spec_helper'
|
|
3
3
|
describe BraintreeRails::ApiError do
|
4
4
|
describe "#to_s" do
|
5
5
|
it "shows only the message" do
|
6
|
-
BraintreeRails::ApiError.new("error_message", "error code").to_s.
|
6
|
+
expect(BraintreeRails::ApiError.new("error_message", "error code").to_s).to eq('error_message')
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
10
|
describe "#inspect" do
|
11
11
|
it "shows only the message" do
|
12
|
-
BraintreeRails::ApiError.new("error_message", "error code").inspect.
|
12
|
+
expect(BraintreeRails::ApiError.new("error_message", "error code").inspect).to eq('#<BraintreeRails::ApiError (error code) error_message>')
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
describe "#empty?" do
|
17
17
|
it "delegate to message" do
|
18
18
|
["", "abc"].each do |message|
|
19
|
-
BraintreeRails::ApiError.new(message, "error code").empty
|
19
|
+
expect(BraintreeRails::ApiError.new(message, "error code").empty?).to eq(message.empty?)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
23
|
-
end
|
23
|
+
end
|
@@ -6,10 +6,10 @@ describe BraintreeRails::Validator do
|
|
6
6
|
begin
|
7
7
|
customer = BraintreeRails::Customer.new(:id => '%')
|
8
8
|
customer.valid?
|
9
|
-
customer.errors[:id].
|
9
|
+
expect(customer.errors[:id]).to_not be_blank
|
10
10
|
|
11
11
|
BraintreeRails::CustomerValidator.setup {[]}
|
12
|
-
customer.
|
12
|
+
expect(customer).to be_valid
|
13
13
|
ensure
|
14
14
|
BraintreeRails::CustomerValidator.setup
|
15
15
|
end
|
@@ -22,13 +22,13 @@ describe BraintreeRails::Validator do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
customer = BraintreeRails::Customer.new(:id => '%')
|
25
|
-
customer.
|
26
|
-
customer.valid?(:create).
|
27
|
-
customer.save.
|
28
|
-
customer.errors[:id].
|
25
|
+
expect(customer).to be_valid
|
26
|
+
expect(customer.valid?(:create)).to eq(false)
|
27
|
+
expect(customer.save).to eq(false)
|
28
|
+
expect(customer.errors[:id]).to_not be_blank
|
29
29
|
ensure
|
30
30
|
BraintreeRails::CustomerValidator.setup
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: braintree-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lin Yang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: braintree
|
@@ -17,6 +17,9 @@ dependencies:
|
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.28.0
|
20
|
+
- - <
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -24,6 +27,9 @@ dependencies:
|
|
24
27
|
- - '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 2.28.0
|
30
|
+
- - <
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: activemodel
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -31,6 +37,9 @@ dependencies:
|
|
31
37
|
- - '>='
|
32
38
|
- !ruby/object:Gem::Version
|
33
39
|
version: '3.0'
|
40
|
+
- - <
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '5'
|
34
43
|
type: :runtime
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -38,6 +47,9 @@ dependencies:
|
|
38
47
|
- - '>='
|
39
48
|
- !ruby/object:Gem::Version
|
40
49
|
version: '3.0'
|
50
|
+
- - <
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '5'
|
41
53
|
- !ruby/object:Gem::Dependency
|
42
54
|
name: activesupport
|
43
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,6 +57,9 @@ dependencies:
|
|
45
57
|
- - '>='
|
46
58
|
- !ruby/object:Gem::Version
|
47
59
|
version: '3.0'
|
60
|
+
- - <
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '5'
|
48
63
|
type: :runtime
|
49
64
|
prerelease: false
|
50
65
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -52,60 +67,63 @@ dependencies:
|
|
52
67
|
- - '>='
|
53
68
|
- !ruby/object:Gem::Version
|
54
69
|
version: '3.0'
|
70
|
+
- - <
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '5'
|
55
73
|
- !ruby/object:Gem::Dependency
|
56
74
|
name: rake
|
57
75
|
requirement: !ruby/object:Gem::Requirement
|
58
76
|
requirements:
|
59
|
-
- -
|
77
|
+
- - ~>
|
60
78
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
79
|
+
version: '10'
|
62
80
|
type: :development
|
63
81
|
prerelease: false
|
64
82
|
version_requirements: !ruby/object:Gem::Requirement
|
65
83
|
requirements:
|
66
|
-
- -
|
84
|
+
- - ~>
|
67
85
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
86
|
+
version: '10'
|
69
87
|
- !ruby/object:Gem::Dependency
|
70
88
|
name: rspec
|
71
89
|
requirement: !ruby/object:Gem::Requirement
|
72
90
|
requirements:
|
73
|
-
- -
|
91
|
+
- - ~>
|
74
92
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
93
|
+
version: '3'
|
76
94
|
type: :development
|
77
95
|
prerelease: false
|
78
96
|
version_requirements: !ruby/object:Gem::Requirement
|
79
97
|
requirements:
|
80
|
-
- -
|
98
|
+
- - ~>
|
81
99
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
100
|
+
version: '3'
|
83
101
|
- !ruby/object:Gem::Dependency
|
84
102
|
name: webmock
|
85
103
|
requirement: !ruby/object:Gem::Requirement
|
86
104
|
requirements:
|
87
|
-
- -
|
105
|
+
- - ~>
|
88
106
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
107
|
+
version: '1'
|
90
108
|
type: :development
|
91
109
|
prerelease: false
|
92
110
|
version_requirements: !ruby/object:Gem::Requirement
|
93
111
|
requirements:
|
94
|
-
- -
|
112
|
+
- - ~>
|
95
113
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
114
|
+
version: '1'
|
97
115
|
- !ruby/object:Gem::Dependency
|
98
116
|
name: coveralls
|
99
117
|
requirement: !ruby/object:Gem::Requirement
|
100
118
|
requirements:
|
101
|
-
- -
|
119
|
+
- - ~>
|
102
120
|
- !ruby/object:Gem::Version
|
103
121
|
version: '0'
|
104
122
|
type: :development
|
105
123
|
prerelease: false
|
106
124
|
version_requirements: !ruby/object:Gem::Requirement
|
107
125
|
requirements:
|
108
|
-
- -
|
126
|
+
- - ~>
|
109
127
|
- !ruby/object:Gem::Version
|
110
128
|
version: '0'
|
111
129
|
description: Provides ActiveModel compatible wrappers for Braintree models and more.
|
@@ -251,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
269
|
version: '0'
|
252
270
|
requirements: []
|
253
271
|
rubyforge_project:
|
254
|
-
rubygems_version: 2.
|
272
|
+
rubygems_version: 2.2.2
|
255
273
|
signing_key:
|
256
274
|
specification_version: 4
|
257
275
|
summary: Provides ActiveModel compatible wrappers for Braintree models.
|