braintree-rails 0.0.1 → 0.0.2
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/MIT-LICENSE +20 -0
- data/README.md +73 -1
- data/braintree-rails.gemspec +1 -1
- data/lib/braintree-rails.rb +13 -7
- data/lib/braintree_rails/address.rb +17 -5
- data/lib/braintree_rails/credit_card.rb +7 -3
- data/lib/braintree_rails/customer.rb +13 -1
- data/lib/braintree_rails/model.rb +9 -0
- data/lib/env.rb +1 -1
- data/log/braintree_test.log +41431 -0
- data/test/unit/braintree_rails/address_test.rb +9 -0
- data/test/unit/braintree_rails/credit_card_test.rb +22 -0
- metadata +3 -2
@@ -45,6 +45,15 @@ describe BraintreeRails::Address do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
describe 'customer' do
|
49
|
+
it 'should load customer for persisted address' do
|
50
|
+
stub_braintree_request(:get, '/customers/customer_id', :body => fixture('customer.xml'))
|
51
|
+
address = BraintreeRails::Customer.new('customer_id').addresses.first
|
52
|
+
address.customer.persisted?.must_equal true
|
53
|
+
address.customer.id.must_equal 'customer_id'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
48
57
|
describe 'validations' do
|
49
58
|
[:first_name, :last_name, :company, :street_address, :extended_address, :locality, :region].each do |attribute|
|
50
59
|
it "should validate length of #{attribute}" do
|
@@ -45,6 +45,15 @@ describe BraintreeRails::CreditCard do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
describe 'customer' do
|
49
|
+
it 'should load customer for persisted credit_card' do
|
50
|
+
credit_card = BraintreeRails::CreditCard.new('credit_card_id')
|
51
|
+
stub_braintree_request(:get, '/customers/customer_id', :body => fixture('customer.xml'))
|
52
|
+
credit_card.customer.persisted?.must_equal true
|
53
|
+
credit_card.customer.id.must_equal 'customer_id'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
48
57
|
describe '#billing_address' do
|
49
58
|
it 'should wrap billing_address with Address object' do
|
50
59
|
credit_card = BraintreeRails::CreditCard.new(OpenStruct.new(:billing_address => nil))
|
@@ -237,4 +246,17 @@ describe BraintreeRails::CreditCard do
|
|
237
246
|
credit_card.errors[:number].wont_be :blank?
|
238
247
|
end
|
239
248
|
end
|
249
|
+
|
250
|
+
describe 'class methods' do
|
251
|
+
it "should wrap Braintree's Model find" do
|
252
|
+
credit_card = BraintreeRails::CreditCard.find('credit_card_id')
|
253
|
+
credit_card.id.must_equal 'credit_card_id'
|
254
|
+
credit_card.persisted?.must_equal true
|
255
|
+
end
|
256
|
+
|
257
|
+
it "should delegate delete to Braintree's Model" do
|
258
|
+
stub_braintree_request(:delete, '/payment_methods/credit_card_id', :body => fixture('credit_card.xml'))
|
259
|
+
BraintreeRails::CreditCard.delete('credit_card_id').must_equal true
|
260
|
+
end
|
261
|
+
end
|
240
262
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: braintree-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
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: 2012-09-
|
12
|
+
date: 2012-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: braintree
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- lib/tasks/test.rake
|
129
129
|
- lib/test_env.rb
|
130
130
|
- log/braintree_test.log
|
131
|
+
- MIT-LICENSE
|
131
132
|
- Rakefile
|
132
133
|
- README.md
|
133
134
|
- test/config/braintree_auth.yml
|