spec/balanced/resources/credit_spec.rb in balanced-1.0.1 vs spec/balanced/resources/credit_spec.rb in balanced-1.0.2
- old
+ new
@@ -11,10 +11,11 @@
:expiration_year => '2015'
).save
# An initial balance for the marketplace
card.debit(:amount => 1000000)
+ @meta = {"order_id" => "1111"}
end
describe '#create', :vcr do
before do
@credit = Balanced::Credit.new(
@@ -23,11 +24,12 @@
:destination => {
:routing_number => '321174851',
:account_number => '0987654321',
:name => 'Timmy T. McTimmerson',
:type => 'checking'
- }
+ },
+ :meta => @meta
).save
end
describe 'amount', :vcr do
subject { @credit.amount }
@@ -37,10 +39,15 @@
describe 'customer', :vcr do
subject { @credit.customer }
it { should be_nil }
end
+ describe 'meta', :vcr do
+ subject { @credit.meta }
+ it { should eq @meta }
+ end
+
end
describe '#reverse', :vcr do
before do
@credit = Balanced::Credit.new(
@@ -49,13 +56,14 @@
:destination => {
:routing_number => '321174851',
:account_number => '0987654321',
:name => 'Timmy T. McTimmerson',
:type => 'checking'
- }
+ },
+ :meta => @meta
).save
- @reversal = @credit.reverse
+ @reversal = @credit.reverse({:meta => @meta})
end
describe '#amount', :vcr do
subject { @reversal.amount }
it { should == 5000 }
@@ -63,32 +71,40 @@
describe '#type', :vcr do
subject { @reversal }
it { should be_instance_of Balanced::Reversal }
end
+
+ describe '#meta', :vcr do
+ subject { @reversal.meta }
+ it { should == @meta }
+ end
+
end
describe 'credit with underwritten customer' do
before do
@customer = Balanced::Customer.new(
:name => 'Henry Ford',
:dob_month => 7,
:dob_year => 1963,
:address => {
:postal_code => '48120'
- }
+ },
+ :meta => @meta
).save
@bank_account = Balanced::BankAccount.new(
:routing_number => '321174851',
:account_number => '9900000003',
:name => 'Larry Bird',
:type => 'checking'
).save
@bank_account.associate_to_customer(@customer)
@credit = @bank_account.credit(
:amount => 5000,
- :description => 'A sweet ride'
+ :description => 'A sweet ride',
+ :meta => @meta
)
end
describe 'merchant_status', :vcr do
subject { @customer.merchant_status }
@@ -101,8 +117,13 @@
end
describe 'status' do
subject { @credit.status }
it { should eq 'succeeded' }
+ end
+
+ describe 'meta', :vcr do
+ subject { @credit.meta }
+ it { should eq @meta }
end
end
end