recurly 0.4.16 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of recurly might be problematic. Click here for more details.
- data/README.markdown +118 -0
- data/bin/recurly +78 -0
- data/lib/rails/generators/recurly/config_generator.rb +16 -0
- data/lib/rails/recurly.rb +13 -0
- data/lib/recurly.rb +64 -139
- data/lib/recurly/account.rb +52 -111
- data/lib/recurly/add_on.rb +20 -0
- data/lib/recurly/adjustment.rb +51 -0
- data/lib/recurly/api.rb +73 -0
- data/lib/recurly/api/errors.rb +205 -0
- data/lib/recurly/api/net_http.rb +77 -0
- data/lib/recurly/billing_info.rb +45 -42
- data/lib/recurly/coupon.rb +63 -8
- data/lib/recurly/helper.rb +39 -0
- data/lib/recurly/invoice.rb +38 -16
- data/lib/recurly/js.rb +113 -0
- data/lib/recurly/money.rb +105 -0
- data/lib/recurly/plan.rb +26 -15
- data/lib/recurly/redemption.rb +34 -0
- data/lib/recurly/resource.rb +925 -0
- data/lib/recurly/resource/pager.rb +210 -0
- data/lib/recurly/subscription.rb +90 -67
- data/lib/recurly/subscription/add_ons.rb +73 -0
- data/lib/recurly/transaction.rb +65 -53
- data/lib/recurly/transaction/errors.rb +98 -0
- data/lib/recurly/version.rb +16 -2
- data/lib/recurly/xml.rb +85 -0
- data/lib/recurly/xml/nokogiri.rb +49 -0
- data/lib/recurly/xml/rexml.rb +50 -0
- metadata +76 -165
- data/LICENSE +0 -21
- data/README.md +0 -104
- data/init.rb +0 -1
- data/lib/patches/rails2/active_resource/base.rb +0 -35
- data/lib/patches/rails2/active_resource/connection.rb +0 -10
- data/lib/patches/rails3/active_model/serializers/xml.rb +0 -28
- data/lib/patches/rails3/active_resource/connection.rb +0 -10
- data/lib/recurly/account_base.rb +0 -35
- data/lib/recurly/base.rb +0 -195
- data/lib/recurly/charge.rb +0 -39
- data/lib/recurly/config_parser.rb +0 -31
- data/lib/recurly/credit.rb +0 -28
- data/lib/recurly/exceptions.rb +0 -32
- data/lib/recurly/formats/xml_with_errors.rb +0 -132
- data/lib/recurly/formats/xml_with_pagination.rb +0 -47
- data/lib/recurly/rails2/compatibility.rb +0 -8
- data/lib/recurly/rails3/railtie.rb +0 -21
- data/lib/recurly/rails3/recurly.rake +0 -28
- data/lib/recurly/transparent.rb +0 -148
- data/lib/recurly/verification.rb +0 -83
- data/spec/config/recurly.yml +0 -6
- data/spec/config/test1.yml +0 -4
- data/spec/config/test2.yml +0 -7
- data/spec/integration/account_spec.rb +0 -286
- data/spec/integration/add_on_spec.rb +0 -84
- data/spec/integration/billing_info_spec.rb +0 -148
- data/spec/integration/charge_spec.rb +0 -176
- data/spec/integration/coupon_spec.rb +0 -49
- data/spec/integration/credit_spec.rb +0 -106
- data/spec/integration/invoice_spec.rb +0 -86
- data/spec/integration/plan_spec.rb +0 -87
- data/spec/integration/subscription_spec.rb +0 -221
- data/spec/integration/transaction_spec.rb +0 -154
- data/spec/integration/transparent_spec.rb +0 -99
- data/spec/spec_helper.rb +0 -34
- data/spec/support/factory.rb +0 -211
- data/spec/support/vcr.rb +0 -11
- data/spec/unit/account_spec.rb +0 -19
- data/spec/unit/billing_info_spec.rb +0 -39
- data/spec/unit/charge_spec.rb +0 -20
- data/spec/unit/config_spec.rb +0 -42
- data/spec/unit/coupon_spec.rb +0 -13
- data/spec/unit/credit_spec.rb +0 -20
- data/spec/unit/plan_spec.rb +0 -18
- data/spec/unit/subscription_spec.rb +0 -25
- data/spec/unit/transaction_spec.rb +0 -32
- data/spec/unit/transparent_spec.rb +0 -152
- data/spec/unit/verification_spec.rb +0 -82
@@ -1,148 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Recurly
|
4
|
-
describe BillingInfo do
|
5
|
-
# version accounts based on this current files modification dates
|
6
|
-
timestamp = File.mtime(__FILE__).to_i
|
7
|
-
|
8
|
-
def verify_billing_info(billing_info, billing_attributes)
|
9
|
-
# check the billing data fields
|
10
|
-
billing_info.first_name.should == billing_attributes[:first_name]
|
11
|
-
billing_info.last_name.should == billing_attributes[:last_name]
|
12
|
-
billing_info.address1.should == billing_attributes[:address1]
|
13
|
-
billing_info.city.should == billing_attributes[:city]
|
14
|
-
billing_info.state.should == billing_attributes[:state]
|
15
|
-
billing_info.zip.should == billing_attributes[:zip]
|
16
|
-
|
17
|
-
# check the credit card fields
|
18
|
-
billing_info.credit_card.last_four.should == billing_attributes[:credit_card][:number][-4, 4]
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "create an account's billing information" do
|
22
|
-
use_vcr_cassette "billing/create/#{timestamp}"
|
23
|
-
let(:account){ Factory.create_account("billing-create-#{timestamp}") }
|
24
|
-
|
25
|
-
before(:each) do
|
26
|
-
@billing_attributes = Factory.billing_attributes({
|
27
|
-
:account_code => account.account_code,
|
28
|
-
:first_name => account.first_name,
|
29
|
-
:last_name => account.last_name
|
30
|
-
})
|
31
|
-
|
32
|
-
@billing_info = BillingInfo.create(@billing_attributes)
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should successfully create the billing info record" do
|
36
|
-
@billing_info.updated_at.should_not be_nil
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should set the correct billing_info on the server " do
|
40
|
-
billing_info = BillingInfo.find(account.account_code)
|
41
|
-
verify_billing_info(billing_info, @billing_attributes)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe "update an account's billing information" do
|
46
|
-
use_vcr_cassette "billing/update/#{timestamp}"
|
47
|
-
let(:account){ Factory.create_account_with_billing_info("billing-update-#{timestamp}") }
|
48
|
-
|
49
|
-
before(:each) do
|
50
|
-
@new_billing_attributes = Factory.billing_attributes({
|
51
|
-
:account_code => account.account_code,
|
52
|
-
:first_name => account.first_name,
|
53
|
-
:last_name => account.last_name,
|
54
|
-
:address1 => "1st Ave South, Apt 5001"
|
55
|
-
})
|
56
|
-
|
57
|
-
@billing_info = BillingInfo.create(@new_billing_attributes)
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should set the correct billing_info on the server " do
|
61
|
-
billing_info = BillingInfo.find(account.account_code)
|
62
|
-
verify_billing_info(billing_info, @new_billing_attributes)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe "get account's billing information" do
|
67
|
-
use_vcr_cassette "billing/find/#{timestamp}"
|
68
|
-
let(:account){ Factory.create_account_with_billing_info("billing-find-#{timestamp}") }
|
69
|
-
|
70
|
-
before(:each) do
|
71
|
-
@billing_attributes = Factory.billing_attributes({
|
72
|
-
:account_code => account.account_code,
|
73
|
-
:first_name => account.first_name,
|
74
|
-
:last_name => account.last_name
|
75
|
-
})
|
76
|
-
|
77
|
-
@billing_info = BillingInfo.find(account.account_code)
|
78
|
-
end
|
79
|
-
|
80
|
-
it "should return the correct billing_info from the server" do
|
81
|
-
billing_info = BillingInfo.find(account.account_code)
|
82
|
-
verify_billing_info(billing_info, @billing_attributes)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe "clearing an account's billing information" do
|
87
|
-
use_vcr_cassette "billing/destroy/#{timestamp}"
|
88
|
-
let(:account){ Factory.create_account("billing-destroy-#{timestamp}") }
|
89
|
-
|
90
|
-
before(:each) do
|
91
|
-
@billing_attributes = Factory.billing_attributes({
|
92
|
-
:account_code => account.account_code,
|
93
|
-
:first_name => account.first_name,
|
94
|
-
:last_name => account.last_name,
|
95
|
-
:address1 => "500 South Central Blvd",
|
96
|
-
:city => "Los Angeles",
|
97
|
-
:state => "CA",
|
98
|
-
:zip => "90001"
|
99
|
-
})
|
100
|
-
|
101
|
-
BillingInfo.create(@billing_attributes)
|
102
|
-
|
103
|
-
@billing_info = BillingInfo.find(account.account_code)
|
104
|
-
end
|
105
|
-
|
106
|
-
it "should allow destroying the billing info for an account" do
|
107
|
-
@billing_info.destroy
|
108
|
-
|
109
|
-
expect {
|
110
|
-
fresh = BillingInfo.find(account.account_code)
|
111
|
-
}.to raise_error ActiveResource::ResourceNotFound
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
describe "set the appropriate error" do
|
116
|
-
use_vcr_cassette "billing/errors/#{timestamp}"
|
117
|
-
let(:account){ Factory.create_account("billing-errors-#{timestamp}") }
|
118
|
-
|
119
|
-
it "should set an error on base if the card number is blank" do
|
120
|
-
@billing_attributes = Factory.billing_attributes({
|
121
|
-
:account_code => account.account_code,
|
122
|
-
:first_name => account.first_name,
|
123
|
-
:last_name => account.last_name,
|
124
|
-
:credit_card => {
|
125
|
-
:number => '',
|
126
|
-
},
|
127
|
-
})
|
128
|
-
|
129
|
-
billing_info = BillingInfo.create(@billing_attributes)
|
130
|
-
billing_info.credit_card.errors[:number].count.should == 1
|
131
|
-
end
|
132
|
-
|
133
|
-
it "should set an error if the card number is invalid" do
|
134
|
-
@billing_attributes = Factory.billing_attributes({
|
135
|
-
:account_code => account.account_code,
|
136
|
-
:first_name => account.first_name,
|
137
|
-
:last_name => account.last_name,
|
138
|
-
:credit_card => {
|
139
|
-
:number => '4000-0000-0000-0002',
|
140
|
-
},
|
141
|
-
})
|
142
|
-
|
143
|
-
billing_info = BillingInfo.create(@billing_attributes)
|
144
|
-
billing_info.credit_card.errors.count.should == 1
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
@@ -1,176 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Recurly
|
4
|
-
describe Charge do
|
5
|
-
# version accounts based on this current files modification dates
|
6
|
-
timestamp = File.mtime(__FILE__).to_i
|
7
|
-
|
8
|
-
describe "list an account's charges" do
|
9
|
-
|
10
|
-
context "all charges" do
|
11
|
-
use_vcr_cassette "charge/list-all/#{timestamp}"
|
12
|
-
|
13
|
-
let(:account) { Factory.create_account("charge-list-all-#{timestamp}") }
|
14
|
-
before(:each) do
|
15
|
-
Factory.create_charge(account.account_code)
|
16
|
-
Factory.create_charge(account.account_code)
|
17
|
-
Factory.create_charge(account.account_code)
|
18
|
-
|
19
|
-
@charges = Charge.list(account.account_code)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should return all the charges" do
|
23
|
-
@charges.length.should == 3
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should also be available via Account#charges" do
|
27
|
-
account.charges.should == @charges
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context "pending charges" do
|
32
|
-
use_vcr_cassette "charge/list-pending/#{timestamp}"
|
33
|
-
|
34
|
-
let(:account) { Factory.create_account("charge-list-pending-#{timestamp}") }
|
35
|
-
before(:each) do
|
36
|
-
Factory.create_charge(account.account_code)
|
37
|
-
Factory.create_charge(account.account_code)
|
38
|
-
Factory.create_charge(account.account_code)
|
39
|
-
|
40
|
-
@charges = Charge.list(account.account_code, :pending)
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should return all the charges" do
|
44
|
-
@charges.length.should == 3
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should also be available via Account#charges" do
|
48
|
-
account.charges(:pending).should == @charges
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
context "invoiced charges" do
|
53
|
-
use_vcr_cassette "charge/list-invoiced/#{timestamp}"
|
54
|
-
|
55
|
-
let(:account) { Factory.create_account("charge-list-invoiced-#{timestamp}") }
|
56
|
-
before(:each) do
|
57
|
-
Factory.create_charge(account.account_code)
|
58
|
-
Factory.create_charge(account.account_code)
|
59
|
-
Factory.create_charge(account.account_code)
|
60
|
-
|
61
|
-
Invoice.create(:account_code => account.account_code)
|
62
|
-
|
63
|
-
Factory.create_charge(account.account_code)
|
64
|
-
|
65
|
-
@charges = Charge.list(account.account_code, :invoiced)
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should return all the charges that were invoiced" do
|
69
|
-
@charges.length.should == 3
|
70
|
-
end
|
71
|
-
|
72
|
-
it "should also be available via Account#charges" do
|
73
|
-
account.charges(:invoiced).should == @charges
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
describe "charge an account" do
|
80
|
-
use_vcr_cassette "charge/create/#{timestamp}"
|
81
|
-
|
82
|
-
let(:account) { Factory.create_account_with_billing_info("charge-create-#{timestamp}") }
|
83
|
-
|
84
|
-
before(:each) do
|
85
|
-
charge = Factory.create_charge account.account_code,
|
86
|
-
:amount => 2.50,
|
87
|
-
:description => "virtual cow maintence fee"
|
88
|
-
|
89
|
-
@charge = Charge.lookup(account.account_code, charge.id)
|
90
|
-
end
|
91
|
-
|
92
|
-
it "should save successfully" do
|
93
|
-
@charge.created_at.should_not be_nil
|
94
|
-
end
|
95
|
-
|
96
|
-
it "should set the amount" do
|
97
|
-
@charge.amount_in_cents.should == 250
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should set the description" do
|
101
|
-
@charge.description.should == "virtual cow maintence fee"
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
describe "lookup a charge" do
|
106
|
-
use_vcr_cassette "charge/lookup/#{timestamp}"
|
107
|
-
|
108
|
-
let(:account) { Factory.create_account("charge-lookup-#{timestamp}") }
|
109
|
-
|
110
|
-
before(:each) do
|
111
|
-
charge = Factory.create_charge account.account_code,
|
112
|
-
:amount => 13.15,
|
113
|
-
:description => "inconvenience fee"
|
114
|
-
|
115
|
-
@charge = Charge.lookup(account.account_code, charge.id)
|
116
|
-
end
|
117
|
-
|
118
|
-
it "should return the correct amount" do
|
119
|
-
@charge.amount_in_cents.should == 1315
|
120
|
-
end
|
121
|
-
|
122
|
-
it "should return the correct description" do
|
123
|
-
@charge.description.should == "inconvenience fee"
|
124
|
-
end
|
125
|
-
|
126
|
-
it "should also be available via Account#lookup_charge" do
|
127
|
-
account.lookup_charge(@charge.id).should == @charge
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
describe "delete a charge" do
|
132
|
-
context "uninvoiced charge" do
|
133
|
-
use_vcr_cassette "charge/delete-uninvoiced/#{timestamp}"
|
134
|
-
|
135
|
-
let(:account) { Factory.create_account("charge-delete-uinvoiced-#{timestamp}")}
|
136
|
-
|
137
|
-
before(:each) do
|
138
|
-
charge = Factory.create_charge account.account_code,
|
139
|
-
:amount => 13.15,
|
140
|
-
:description => "inconvenience fee"
|
141
|
-
|
142
|
-
@charge = Charge.lookup(account.account_code, charge.id)
|
143
|
-
@charge.destroy
|
144
|
-
end
|
145
|
-
|
146
|
-
it "should remove the charge" do
|
147
|
-
expect{
|
148
|
-
Charge.lookup(account.account_code, @charge.id)
|
149
|
-
}.to raise_error ActiveResource::ResourceNotFound
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
context "invoiced charge" do
|
154
|
-
use_vcr_cassette "charge/delete-uninvoiced/#{timestamp}"
|
155
|
-
|
156
|
-
let(:account) { Factory.create_account("charge-delete-uinvoiced-#{timestamp}")}
|
157
|
-
|
158
|
-
before(:each) do
|
159
|
-
charge = Factory.create_charge account.account_code,
|
160
|
-
:amount => 13.15,
|
161
|
-
:description => "inconvenience fee"
|
162
|
-
|
163
|
-
@charge = Charge.lookup(account.account_code, charge.id)
|
164
|
-
Invoice.create(:account_code => account.account_code)
|
165
|
-
|
166
|
-
end
|
167
|
-
|
168
|
-
it "should not remove the charge" do
|
169
|
-
pending "should not throw a 500 error"
|
170
|
-
@charge.destroy.should be_false
|
171
|
-
Charge.lookup(account.account_code, @charge.id).should == @charge
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
176
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Recurly
|
4
|
-
describe Coupon do
|
5
|
-
# version accounts based on this current files modification dates
|
6
|
-
timestamp = File.mtime(__FILE__).to_i
|
7
|
-
|
8
|
-
describe "redeem a coupon" do
|
9
|
-
use_vcr_cassette "coupon/create/#{timestamp}"
|
10
|
-
let(:account){ Factory.create_account("coupon-create-#{timestamp}") }
|
11
|
-
|
12
|
-
before(:each) do
|
13
|
-
@coupon_attributes = {
|
14
|
-
:account_code => account.account_code,
|
15
|
-
:coupon_code => 'coupon'
|
16
|
-
}
|
17
|
-
@coupon = Coupon.create(@coupon_attributes)
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should lookup an applied coupon" do
|
21
|
-
coupon_lookup = account.coupon
|
22
|
-
coupon_lookup.coupon_code.should == @coupon.coupon_code
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should successfully apply the coupon to the account" do
|
26
|
-
@coupon.coupon_code.should_not be_nil
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "remove a coupon" do
|
31
|
-
use_vcr_cassette "coupon/destroy/#{timestamp}"
|
32
|
-
let(:account){ Factory.create_account("coupon-destroy-#{timestamp}") }
|
33
|
-
|
34
|
-
before(:each) do
|
35
|
-
@coupon_attributes = {
|
36
|
-
:account_code => account.account_code,
|
37
|
-
:coupon_code => 'coupon'
|
38
|
-
}
|
39
|
-
@coupon = Coupon.create(@coupon_attributes)
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should successfully remove a coupon" do
|
43
|
-
@coupon.destroy
|
44
|
-
|
45
|
-
lambda { Coupon.find(account.account_code) }.should raise_error(ActiveResource::ResourceNotFound)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,106 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Recurly
|
4
|
-
describe Credit do
|
5
|
-
# version accounts based on this current files modification dates
|
6
|
-
timestamp = File.mtime(__FILE__).to_i
|
7
|
-
|
8
|
-
describe "credit an account" do
|
9
|
-
use_vcr_cassette "credit/create/#{timestamp}"
|
10
|
-
|
11
|
-
let(:account){ Factory.create_account("credit-create-#{timestamp}") }
|
12
|
-
|
13
|
-
before(:each) do
|
14
|
-
credit = Factory.create_credit account.account_code,
|
15
|
-
:amount_in_cents => 1005,
|
16
|
-
:description => "free moniez"
|
17
|
-
|
18
|
-
@credit = Credit.lookup(account.account_code, credit.id)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should save successfully" do
|
22
|
-
@credit.created_at.should_not be_nil
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should set the amount" do
|
26
|
-
@credit.amount_in_cents.should == -1005
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should set the description" do
|
30
|
-
@credit.description.should == "free moniez"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "list an account's credits" do
|
35
|
-
use_vcr_cassette "credit/list/#{timestamp}"
|
36
|
-
let(:account){ Factory.create_account("credit-list-#{timestamp}") }
|
37
|
-
|
38
|
-
before(:each) do
|
39
|
-
Factory.create_credit(account.account_code, :amount_in_cents => 100, :description => "one")
|
40
|
-
Factory.create_credit(account.account_code, :amount_in_cents => 200, :description => "two")
|
41
|
-
Factory.create_credit(account.account_code, :amount_in_cents => 300, :description => "three")
|
42
|
-
@credits = Credit.list(account.account_code)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should return results" do
|
46
|
-
@credits.length.should == 3
|
47
|
-
end
|
48
|
-
|
49
|
-
it "amounts should be correct" do
|
50
|
-
@credits.map{|c| c.amount_in_cents}.should == [-300, -200, -100]
|
51
|
-
end
|
52
|
-
|
53
|
-
it "descriptions should be correct" do
|
54
|
-
@credits.map{|c| c.description}.should == ["three", "two", "one"]
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should also be available via Account#credits" do
|
58
|
-
account.credits.should == @credits
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "lookup a credit" do
|
63
|
-
use_vcr_cassette "credit/lookup/#{timestamp}"
|
64
|
-
let(:account) { Factory.create_account("credit-lookup-#{timestamp}") }
|
65
|
-
|
66
|
-
before(:each) do
|
67
|
-
credit = Factory.create_credit account.account_code,
|
68
|
-
:amount_in_cents => 1315,
|
69
|
-
:description => "free moniez 4 u"
|
70
|
-
@credit = Credit.lookup(account.account_code, credit.id)
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should return the correct amount" do
|
74
|
-
@credit.amount_in_cents.should == -1315
|
75
|
-
end
|
76
|
-
|
77
|
-
it "should return the correct description" do
|
78
|
-
@credit.description.should == "free moniez 4 u"
|
79
|
-
end
|
80
|
-
|
81
|
-
it "should also be available via Account#lookup_credit" do
|
82
|
-
account.lookup_credit(@credit.id).should == @credit
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe "delete credit" do
|
87
|
-
use_vcr_cassette "credit/delete/#{timestamp}"
|
88
|
-
let(:account) { Factory.create_account("delete-uninvoiced-#{timestamp}") }
|
89
|
-
|
90
|
-
before(:each) do
|
91
|
-
credit = Factory.create_credit account.account_code,
|
92
|
-
:amount_in_cents => 1315,
|
93
|
-
:description => "free moniez 4 u"
|
94
|
-
@credit = Credit.lookup(account.account_code, credit.id)
|
95
|
-
|
96
|
-
@credit.destroy
|
97
|
-
end
|
98
|
-
|
99
|
-
it "should remove the credit" do
|
100
|
-
expect {
|
101
|
-
Credit.lookup(account.account_code, @credit.id)
|
102
|
-
}.to raise_error ActiveResource::ResourceNotFound
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|