ashmont 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74db341df8df089b92b9f99d600e7de04cc262ad
4
- data.tar.gz: 38babe59083f00ce8987f4fa93d5dac2b919cf01
3
+ metadata.gz: 4cbc767616cdfb36fa0361192652eb7260cf7819
4
+ data.tar.gz: dfcfe21d97c3bc0141650d489b2f9e15353fb042
5
5
  SHA512:
6
- metadata.gz: 42eb167922b1dc1fa663da7ac3b01d5ddc38e3aa6bd19d69c45f497f51323b2b6e3de158c7d9e910769976ccd887141dd76575936340262e108c81c7ced8be4e
7
- data.tar.gz: 6fda5ace2fed98cb908476b265239603e91556d7aca60375caddfc16c00bcb714b7920c4c06fb73478b0f8407dbc99b5840e9ce828c6daa6c5feb985ff49745b
6
+ metadata.gz: 2bacaf4575b5a27b377a7fbf64b8b2bbfc14f3681f57c0ebece26f82f81c0036d7186e22ace36328fd4b7ad118f45a0ca87774540a938d86bdcc9bf618d90ce2
7
+ data.tar.gz: fc714edba413131497708bdb572d60ce885993b00fb5fdc9fcee26b776801395e22b4920ca39c14eb2399eb98448a89c7260b6f379d42cc548580291970aa748
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ##v0.0.15
2
+ * bumped release version
3
+
4
+ ##v0.0.14a
5
+ * modernized tests
6
+
1
7
  ##v0.0.13
2
8
  * added to Travis CI for testing
3
9
 
data/ashmont.gemspec CHANGED
@@ -19,9 +19,9 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_dependency('braintree', '>= 2.74.0')
22
- s.add_dependency('activesupport', '>= 3.0.0')
23
- s.add_dependency('i18n', '>= 0.6')
24
- s.add_dependency('tzinfo', '>= 0.3')
22
+ s.add_dependency('activesupport', '~> 5.0', '>= 5.0.2')
23
+ s.add_dependency('i18n', '~> 0.8.1')
24
+ s.add_dependency('tzinfo', '~> 1.2', '>= 1.2.3')
25
25
  s.add_development_dependency('bourne')
26
26
  s.add_development_dependency('rake')
27
27
  s.add_development_dependency('rspec')
@@ -1,5 +1,6 @@
1
1
  require "ashmont/errors"
2
- require "active_support/core_ext"
2
+ require 'active_support'
3
+ require 'active_support/core_ext'
3
4
  require "braintree"
4
5
 
5
6
  module Ashmont
@@ -1,3 +1,3 @@
1
1
  module Ashmont
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
@@ -9,12 +9,12 @@ describe Ashmont::Customer do
9
9
 
10
10
  result = Ashmont::Customer.new(token).credit_card
11
11
 
12
- Braintree::Customer.should have_received(:find).with(token)
13
- result.should == "first"
12
+ expect(Braintree::Customer).to have_received(:find).with(token)
13
+ expect(result).to eq("first")
14
14
  end
15
15
 
16
16
  it "returns nothing without a remote customer" do
17
- Ashmont::Customer.new.credit_card.should be_nil
17
+ expect(Ashmont::Customer.new.credit_card).to be_nil
18
18
  end
19
19
 
20
20
  it "returns all credit cards" do
@@ -24,12 +24,12 @@ describe Ashmont::Customer do
24
24
 
25
25
  result = Ashmont::Customer.new(token).credit_cards
26
26
 
27
- Braintree::Customer.should have_received(:find).with(token)
28
- result.should == ["first", "second"]
27
+ expect(Braintree::Customer).to have_received(:find).with(token)
28
+ expect(result).to eq(["first", "second"])
29
29
  end
30
30
 
31
31
  it "returns an empty array without a remote customer" do
32
- Ashmont::Customer.new.credit_cards.should == []
32
+ expect(Ashmont::Customer.new.credit_cards).to eq([])
33
33
  end
34
34
 
35
35
 
@@ -37,11 +37,11 @@ describe Ashmont::Customer do
37
37
  remote_customer = stub("customer", :email => "admin@example.com")
38
38
  Braintree::Customer.stubs(:find => remote_customer)
39
39
 
40
- Ashmont::Customer.new("abc").billing_email.should == "admin@example.com"
40
+ expect(Ashmont::Customer.new("abc").billing_email).to eq("admin@example.com")
41
41
  end
42
42
 
43
43
  it "doesn't have an email without a remote customer" do
44
- Ashmont::Customer.new.billing_email.should be_nil
44
+ expect(Ashmont::Customer.new.billing_email).to be_nil
45
45
  end
46
46
 
47
47
  it "creates a valid remote customer" do
@@ -52,11 +52,11 @@ describe Ashmont::Customer do
52
52
  Braintree::Customer.stubs(:create => create_result)
53
53
 
54
54
  customer = Ashmont::Customer.new
55
- customer.save(attributes).should be_true
55
+ expect(customer.save(attributes)).to be true
56
56
 
57
- Braintree::Customer.should have_received(:create).with(:email => "ben@example.com", :credit_card => {})
58
- customer.token.should == token
59
- customer.errors.should be_empty
57
+ expect(Braintree::Customer).to have_received(:create).with(:email => "ben@example.com", :credit_card => {})
58
+ expect(customer.token).to eq(token)
59
+ expect(customer.errors).to be_empty
60
60
  end
61
61
 
62
62
  it "creates a remote customer with a credit card" do
@@ -82,7 +82,7 @@ describe Ashmont::Customer do
82
82
  :country_name => "United States of America"
83
83
  )
84
84
 
85
- Braintree::Customer.should have_received(:create).with(
85
+ expect(Braintree::Customer).to have_received(:create).with(
86
86
  :email => "jrobot@example.com",
87
87
  :credit_card => {
88
88
  :cardholder_name => "Jim Robot",
@@ -114,10 +114,10 @@ describe Ashmont::Customer do
114
114
  Ashmont::Errors.stubs(:new => errors)
115
115
 
116
116
  customer = Ashmont::Customer.new
117
- customer.save("email" => "ben.franklin@example.com").should be_false
117
+ expect(customer.save("email" => "ben.franklin@example.com")).to be false
118
118
 
119
- Ashmont::Errors.should have_received(:new).with(verification, error_messages)
120
- customer.errors.should == errors
119
+ expect(Ashmont::Errors).to have_received(:new).with(verification, error_messages)
120
+ expect(customer.errors).to eq(errors)
121
121
  end
122
122
 
123
123
  it "updates a remote customer with valid changes" do
@@ -128,10 +128,10 @@ describe Ashmont::Customer do
128
128
  Braintree::Customer.stubs(:update => update_result)
129
129
 
130
130
  customer = Ashmont::Customer.new(token)
131
- customer.save(updates).should be_true
131
+ expect(customer.save(updates)).to be true
132
132
 
133
- Braintree::Customer.should have_received(:update).with(token, :email => "somebody@example.com", :credit_card => {})
134
- customer.billing_email.should == "somebody@example.com"
133
+ expect(Braintree::Customer).to have_received(:update).with(token, :email => "somebody@example.com", :credit_card => {})
134
+ expect(customer.billing_email).to eq("somebody@example.com")
135
135
  end
136
136
 
137
137
  it "updates a remote customer with a credit card" do
@@ -159,7 +159,7 @@ describe Ashmont::Customer do
159
159
  :country_name => "United States of America"
160
160
  )
161
161
 
162
- Braintree::Customer.should have_received(:update).with(
162
+ expect(Braintree::Customer).to have_received(:update).with(
163
163
  token,
164
164
  :email => "jrobot@example.com",
165
165
  :credit_card => {
@@ -195,10 +195,10 @@ describe Ashmont::Customer do
195
195
  Ashmont::Errors.stubs(:new => errors)
196
196
 
197
197
  customer = Ashmont::Customer.new("xyz")
198
- customer.save("email" => "ben.franklin@example.com").should be_false
198
+ expect(customer.save("email" => "ben.franklin@example.com")).to be false
199
199
 
200
- Ashmont::Errors.should have_received(:new).with(verification, error_messages)
201
- customer.errors.should == errors
200
+ expect(Ashmont::Errors).to have_received(:new).with(verification, error_messages)
201
+ expect(customer.errors).to eq(errors)
202
202
  end
203
203
 
204
204
  it "delete a remote customer" do
@@ -208,7 +208,7 @@ describe Ashmont::Customer do
208
208
  customer = Ashmont::Customer.new(token)
209
209
  customer.delete
210
210
 
211
- Braintree::Customer.should have_received(:delete).with(token)
211
+ expect(Braintree::Customer).to have_received(:delete).with(token)
212
212
  end
213
213
 
214
214
  it "has billing info with a credit card" do
@@ -218,8 +218,8 @@ describe Ashmont::Customer do
218
218
  Braintree::Customer.stubs(:find => remote_customer)
219
219
 
220
220
  customer = Ashmont::Customer.new("xyz")
221
- customer.should have_billing_info
222
- customer.payment_method_token.should == token
221
+ expect(customer).to have_billing_info
222
+ expect(customer.payment_method_token).to eq(token)
223
223
  end
224
224
 
225
225
  it "doesn't have billing info without a credit card" do
@@ -227,8 +227,8 @@ describe Ashmont::Customer do
227
227
  Braintree::Customer.stubs(:find => remote_customer)
228
228
 
229
229
  customer = Ashmont::Customer.new("xyz")
230
- customer.should_not have_billing_info
231
- customer.payment_method_token.should be_nil
230
+ expect(customer).to_not have_billing_info
231
+ expect(customer.payment_method_token).to be_nil
232
232
  end
233
233
 
234
234
  %w(last_4 cardholder_name expiration_month expiration_year).each do |credit_card_attribute|
@@ -237,7 +237,7 @@ describe Ashmont::Customer do
237
237
  remote_customer = stub("customer", :credit_cards => [credit_card])
238
238
  Braintree::Customer.stubs(:find => remote_customer)
239
239
 
240
- Ashmont::Customer.new("xyz").send(credit_card_attribute).should == "expected"
240
+ expect(Ashmont::Customer.new("xyz").send(credit_card_attribute)).to eq("expected")
241
241
  end
242
242
  end
243
243
 
@@ -248,7 +248,7 @@ describe Ashmont::Customer do
248
248
  remote_customer = stub("customer", :credit_cards => [credit_card])
249
249
  Braintree::Customer.stubs(:find => remote_customer)
250
250
 
251
- Ashmont::Customer.new("xyz").send(billing_address_attribute).should == "expected"
251
+ expect(Ashmont::Customer.new("xyz").send(billing_address_attribute)).to eq("expected")
252
252
  end
253
253
  end
254
254
 
@@ -260,10 +260,10 @@ describe Ashmont::Customer do
260
260
  Braintree::TransparentRedirect.stubs(:confirm => confirm_result)
261
261
 
262
262
  customer = Ashmont::Customer.new
263
- customer.confirm(query_string).should be_true
263
+ expect(customer.confirm(query_string)).to be true
264
264
 
265
- Braintree::TransparentRedirect.should have_received(:confirm).with(query_string)
266
- customer.token.should == token
265
+ expect(Braintree::TransparentRedirect).to have_received(:confirm).with(query_string)
266
+ expect(customer.token).to eq(token)
267
267
  end
268
268
 
269
269
  it "adds errors for an invalid transparent redirect query string" do
@@ -278,9 +278,9 @@ describe Ashmont::Customer do
278
278
  Ashmont::Errors.stubs(:new => errors)
279
279
 
280
280
  customer = Ashmont::Customer.new
281
- customer.confirm("abc").should be_false
281
+ expect(customer.confirm("abc")).to be false
282
282
 
283
- Ashmont::Errors.should have_received(:new).with(verification, error_messages)
284
- customer.errors.should == errors
283
+ expect(Ashmont::Errors).to have_received(:new).with(verification, error_messages)
284
+ expect(customer.errors).to eq(errors)
285
285
  end
286
286
  end
@@ -2,38 +2,38 @@ require 'spec_helper'
2
2
 
3
3
  describe Ashmont::Errors do
4
4
  it "adds an error for a declined number" do
5
- errors_for(:status => "processor_declined", :processor_response_text => "failure").
6
- should include("number was denied by the payment processor with the message: failure")
5
+ expect(errors_for(:status => "processor_declined", :processor_response_text => "failure")).
6
+ to include("number was denied by the payment processor with the message: failure")
7
7
  end
8
8
 
9
9
  it "adds an error for a mismatched cvv" do
10
- errors_for(:status => "gateway_rejected").should include("cvv did not match")
10
+ expect(errors_for(:status => "gateway_rejected")).to include("cvv did not match")
11
11
  end
12
12
 
13
13
  it "adds a generic card number error" do
14
- errors_for(:messages => { :number => "Credit card number is unsupported" }).
15
- should include("number is unsupported")
14
+ expect(errors_for(:messages => { :number => "Credit card number is unsupported" })).
15
+ to include("number is unsupported")
16
16
  end
17
17
 
18
18
  it "adds a generic cvv error" do
19
- errors_for(:messages => { :CVV => "CVV is unsupported" }).
20
- should include("cvv is unsupported")
19
+ expect(errors_for(:messages => { :CVV => "CVV is unsupported" })).
20
+ to include("cvv is unsupported")
21
21
  end
22
22
 
23
23
  it "adds a generic expiration_month error" do
24
- errors_for(:messages => { :expiration_month => "Expiration month is unsupported" }).
25
- should include("expiration_month is unsupported")
24
+ expect(errors_for(:messages => { :expiration_month => "Expiration month is unsupported" })).
25
+ to include("expiration_month is unsupported")
26
26
  end
27
27
 
28
28
  it "adds a generic expiration_year error" do
29
- errors_for(:messages => { :expiration_year => "Expiration year is unsupported" }).
30
- should include("expiration_year is unsupported")
29
+ expect(errors_for(:messages => { :expiration_year => "Expiration year is unsupported" })).
30
+ to include("expiration_year is unsupported")
31
31
  end
32
32
 
33
33
  it "handles error results without a status" do
34
34
  result = {}
35
35
  errors = [ stub("error", :attribute => "foo", :message => "bar") ]
36
- expect { Ashmont::Errors.new(result, errors).to_hash }.to_not raise_error(NoMethodError)
36
+ expect { Ashmont::Errors.new(result, errors).to_hash }.to_not raise_error
37
37
  end
38
38
 
39
39
  def errors_for(options = {})
@@ -10,8 +10,8 @@ describe Ashmont::SubscribedCustomer do
10
10
  delegated_methods.each do |method|
11
11
  customer.stubs(method => "expected")
12
12
  result = subscribed_customer.send(method, "argument")
13
- customer.should have_received(method).with("argument")
14
- result.should == "expected"
13
+ expect(customer).to have_received(method).with("argument")
14
+ expect(result).to eq("expected")
15
15
  end
16
16
  end
17
17
 
@@ -21,15 +21,15 @@ describe Ashmont::SubscribedCustomer do
21
21
  %w(reload status next_billing_date transactions most_recent_transaction retry_charge past_due?).each do |method|
22
22
  subscription.stubs(method => "expected")
23
23
  result = subscribed_customer.send(method, "argument")
24
- subscription.should have_received(method).with("argument")
25
- result.should == "expected"
24
+ expect(subscription).to have_received(method).with("argument")
25
+ expect(result).to eq("expected")
26
26
  end
27
27
  end
28
28
 
29
29
  it "delegates #subscription_token to its subscription's token" do
30
30
  subscription = stub("subscription", :token => "expected")
31
31
  subscribed_customer = build_subscribed_customer(:subscription => subscription)
32
- subscribed_customer.subscription_token.should == "expected"
32
+ expect(subscribed_customer.subscription_token).to eq("expected")
33
33
  end
34
34
 
35
35
  it "#reloads the subscription" do
@@ -38,8 +38,8 @@ describe Ashmont::SubscribedCustomer do
38
38
 
39
39
  result = subscribed_customer.reload
40
40
 
41
- subscription.should have_received(:reload)
42
- result.should == "expected"
41
+ expect(subscription).to have_received(:reload)
42
+ expect(result).to eq("expected")
43
43
  end
44
44
 
45
45
  it "can #save the customer" do
@@ -49,8 +49,8 @@ describe Ashmont::SubscribedCustomer do
49
49
 
50
50
  result = subscribed_customer.save(attributes)
51
51
 
52
- customer.should have_received(:save).with(attributes)
53
- result.should be_true
52
+ expect(customer).to have_received(:save).with(attributes)
53
+ expect(result).to be true
54
54
  end
55
55
 
56
56
  it "saves a new customer without attributes" do
@@ -59,7 +59,7 @@ describe Ashmont::SubscribedCustomer do
59
59
 
60
60
  subscribed_customer.save({})
61
61
 
62
- customer.should have_received(:save).with({})
62
+ expect(customer).to have_received(:save).with({})
63
63
  end
64
64
 
65
65
  it "doesn't #save the customer without any customer attributes" do
@@ -69,7 +69,7 @@ describe Ashmont::SubscribedCustomer do
69
69
 
70
70
  subscribed_customer.save(attributes)
71
71
 
72
- customer.should have_received(:save).never
72
+ expect(customer).to have_received(:save).never
73
73
  end
74
74
 
75
75
  it "can #save the subscription" do
@@ -81,8 +81,8 @@ describe Ashmont::SubscribedCustomer do
81
81
 
82
82
  result = subscribed_customer.save(attributes)
83
83
 
84
- subscription.should have_received(:save).with(:plan_id => 41, :price => "15", :payment_method_token => payment_method_token)
85
- result.should == "expected"
84
+ expect(subscription).to have_received(:save).with(:plan_id => 41, :price => "15", :payment_method_token => payment_method_token)
85
+ expect(result).to eq("expected")
86
86
  end
87
87
 
88
88
  it "retries the subscription when past due" do
@@ -91,7 +91,7 @@ describe Ashmont::SubscribedCustomer do
91
91
  subscribed_customer = build_subscribed_customer(:subscription => subscription)
92
92
  subscribed_customer.save({})
93
93
 
94
- subscription.should have_received(:retry_charge)
94
+ expect(subscription).to have_received(:retry_charge)
95
95
  end
96
96
 
97
97
  it "merges #errors from the customer and subscription" do
@@ -99,7 +99,7 @@ describe Ashmont::SubscribedCustomer do
99
99
  customer = stub("customer", :errors => stub_errors("two" => "second"))
100
100
  subscribed_customer = build_subscribed_customer(:subscription => subscription, :customer => customer)
101
101
 
102
- subscribed_customer.errors.to_hash.should == { "one" => "first", "two" => "second" }
102
+ expect(subscribed_customer.errors.to_hash).to eq({ "one" => "first", "two" => "second" })
103
103
  end
104
104
 
105
105
  def build_subscribed_customer(options = {})
@@ -6,8 +6,8 @@ describe Ashmont::Subscription do
6
6
  remote_subscription = stub_remote_subscription(delegated_method => "expected")
7
7
  subscription = Ashmont::Subscription.new(remote_subscription.id)
8
8
  result = subscription.send(delegated_method)
9
- Braintree::Subscription.should have_received(:find).with(remote_subscription.id)
10
- result.should == "expected"
9
+ expect(Braintree::Subscription).to have_received(:find).with(remote_subscription.id)
10
+ expect(result).to eq("expected")
11
11
  end
12
12
  end
13
13
 
@@ -16,17 +16,17 @@ describe Ashmont::Subscription do
16
16
  remote_subscription = stub_remote_subscription(:next_billing_date => unconverted_date)
17
17
  subscription = Ashmont::Subscription.new("xyz")
18
18
  result = subscription.next_billing_date
19
- result.utc_offset.should == ActiveSupport::TimeZone[Ashmont.merchant_account_time_zone].utc_offset
20
- result.strftime("%Y-%m-%d").should == unconverted_date
19
+ expect(result.utc_offset).to eq(ActiveSupport::TimeZone[Ashmont.merchant_account_time_zone].utc_offset)
20
+ expect(result.strftime("%Y-%m-%d")).to eq(unconverted_date)
21
21
  end
22
22
 
23
23
  it "doesn't have a next billing date without a remote subscription" do
24
- Ashmont::Subscription.new.next_billing_date.should be_nil
24
+ expect(Ashmont::Subscription.new.next_billing_date).to be_nil
25
25
  end
26
26
 
27
27
  it "returns the token" do
28
28
  subscription = Ashmont::Subscription.new('abc')
29
- subscription.token.should == 'abc'
29
+ expect(subscription.token).to eq('abc')
30
30
  end
31
31
 
32
32
  it "retries a subscription" do
@@ -39,11 +39,11 @@ describe Ashmont::Subscription do
39
39
  Braintree::Transaction.stubs(:submit_for_settlement => settlement_result)
40
40
 
41
41
  subscription = Ashmont::Subscription.new(subscription_token)
42
- subscription.retry_charge.should be_true
43
- subscription.errors.should be_empty
42
+ expect(subscription.retry_charge).to be true
43
+ expect(subscription.errors).to be_empty
44
44
 
45
- Braintree::Subscription.should have_received(:retry_charge).with(subscription_token)
46
- Braintree::Transaction.should have_received(:submit_for_settlement).with(transaction_token)
45
+ expect(Braintree::Subscription).to have_received(:retry_charge).with(subscription_token)
46
+ expect(Braintree::Transaction).to have_received(:submit_for_settlement).with(transaction_token)
47
47
  end
48
48
 
49
49
  it "has errors after a failed subscription retry" do
@@ -59,12 +59,12 @@ describe Ashmont::Subscription do
59
59
  Ashmont::Errors.stubs(:new => errors)
60
60
 
61
61
  subscription = Ashmont::Subscription.new(subscription_token)
62
- subscription.retry_charge.should be_false
63
- subscription.errors.should == errors
62
+ expect(subscription.retry_charge).to be false
63
+ expect(subscription.errors).to eq(errors)
64
64
 
65
- Braintree::Subscription.should have_received(:retry_charge).with(subscription_token)
66
- Braintree::Transaction.should have_received(:submit_for_settlement).with(transaction_token)
67
- Ashmont::Errors.should have_received(:new).with(transaction, error_messages)
65
+ expect(Braintree::Subscription).to have_received(:retry_charge).with(subscription_token)
66
+ expect(Braintree::Transaction).to have_received(:submit_for_settlement).with(transaction_token)
67
+ expect(Ashmont::Errors).to have_received(:new).with(transaction, error_messages)
68
68
  end
69
69
 
70
70
  it "reloads the subscription after retrying a charge" do
@@ -88,8 +88,8 @@ describe Ashmont::Subscription do
88
88
  subscription = Ashmont::Subscription.new(token)
89
89
  result = subscription.save(:name => "Billy")
90
90
 
91
- Braintree::Subscription.should have_received(:update).with(token, has_entries(:name => "Billy"))
92
- result.should == "expected"
91
+ expect(Braintree::Subscription).to have_received(:update).with(token, has_entries(:name => "Billy"))
92
+ expect(result).to eq("expected")
93
93
  end
94
94
 
95
95
  it "creates a successful subscription" do
@@ -99,11 +99,11 @@ describe Ashmont::Subscription do
99
99
  Braintree::Subscription.stubs(:create => result)
100
100
 
101
101
  subscription = Ashmont::Subscription.new
102
- subscription.save(attributes).should be_true
102
+ expect(subscription.save(attributes)).to be true
103
103
 
104
- Braintree::Subscription.should have_received(:create).with(has_entries(attributes))
105
- subscription.token.should == remote_subscription.id
106
- subscription.status.should == "fine"
104
+ expect(Braintree::Subscription).to have_received(:create).with(has_entries(attributes))
105
+ expect(subscription.token).to eq(remote_subscription.id)
106
+ expect(subscription.status).to eq("fine")
107
107
  end
108
108
 
109
109
  it "passes a configured merchant account id" do
@@ -115,7 +115,7 @@ describe Ashmont::Subscription do
115
115
  subscription = Ashmont::Subscription.new
116
116
  subscription.save({})
117
117
 
118
- Braintree::Subscription.should have_received(:create).with(has_entries(:merchant_account_id => merchant_account_id))
118
+ expect(Braintree::Subscription).to have_received(:create).with(has_entries(:merchant_account_id => merchant_account_id))
119
119
  end
120
120
  end
121
121
 
@@ -127,7 +127,7 @@ describe Ashmont::Subscription do
127
127
  subscription = Ashmont::Subscription.new
128
128
  subscription.save({})
129
129
 
130
- Braintree::Subscription.should have_received(:create).with(has_entries(:merchant_account_id => nil)).never
130
+ expect(Braintree::Subscription).to have_received(:create).with(has_entries(:merchant_account_id => nil)).never
131
131
  end
132
132
 
133
133
  it "returns the most recent transaction" do
@@ -138,7 +138,7 @@ describe Ashmont::Subscription do
138
138
 
139
139
  subscription = Ashmont::Subscription.new("xyz")
140
140
 
141
- subscription.most_recent_transaction.created_at.should == 1.day.ago
141
+ expect(subscription.most_recent_transaction.created_at).to eq(1.day.ago)
142
142
  end
143
143
  end
144
144
 
@@ -147,40 +147,40 @@ describe Ashmont::Subscription do
147
147
  new_remote_subscription = stub_remote_subscription(:status => "new")
148
148
  Braintree::Subscription.stubs(:find).returns(old_remote_subscription).then.returns(new_remote_subscription)
149
149
  subscription = Ashmont::Subscription.new(old_remote_subscription.id)
150
- subscription.status.should == "old"
151
- subscription.reload.status.should == "new"
150
+ expect(subscription.status).to eq("old")
151
+ expect(subscription.reload.status).to eq("new")
152
152
  end
153
153
 
154
154
  it "finds status from the remote subscription" do
155
155
  remote_subscription = stub_remote_subscription(:status => "a-ok")
156
156
  subscription = Ashmont::Subscription.new("xyz")
157
- subscription.status.should == "a-ok"
157
+ expect(subscription.status).to eq("a-ok")
158
158
  end
159
159
 
160
160
  it "doesn't have status without a remote subscription" do
161
161
  subscription = Ashmont::Subscription.new(nil)
162
- subscription.status.should be_nil
162
+ expect(subscription.status).to be_nil
163
163
  end
164
164
 
165
165
  it "uses a cached status when provided" do
166
166
  remote_subscription = stub_remote_subscription(:status => "past-due")
167
167
  subscription = Ashmont::Subscription.new("xyz", :status => "a-ok")
168
- subscription.status.should == "a-ok"
168
+ expect(subscription.status).to eq("a-ok")
169
169
  end
170
170
 
171
171
  it "updates the cached status when reloading" do
172
172
  remote_subscription = stub_remote_subscription(:status => "active")
173
173
  subscription = Ashmont::Subscription.new("xyz", :status => "past-due")
174
174
  subscription.reload
175
- subscription.status.should == "active"
175
+ expect(subscription.status).to eq("active")
176
176
  end
177
177
 
178
178
  it "is past due with a past due status" do
179
- Ashmont::Subscription.new("xyz", :status => Braintree::Subscription::Status::PastDue).should be_past_due
179
+ expect(Ashmont::Subscription.new("xyz", :status => Braintree::Subscription::Status::PastDue)).to be_past_due
180
180
  end
181
181
 
182
182
  it "isn't past due with an active status" do
183
- Ashmont::Subscription.new("xyz", :status => Braintree::Subscription::Status::Active).should_not be_past_due
183
+ expect(Ashmont::Subscription.new("xyz", :status => Braintree::Subscription::Status::Active)).to_not be_past_due
184
184
  end
185
185
 
186
186
  def with_configured_merchant_acount_id
data/spec/ashmont_spec.rb CHANGED
@@ -5,7 +5,7 @@ RSpec.describe Ashmont do
5
5
  expect(Ashmont::VERSION).not_to be nil
6
6
  end
7
7
 
8
- it "does something useful" do
9
- expect(false).to eq(true)
10
- end
8
+ # it "does something useful" do
9
+ # expect(false).to eq(true)
10
+ # end
11
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ashmont
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoughtbot
@@ -29,44 +29,56 @@ dependencies:
29
29
  name: activesupport
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '5.0'
32
35
  - - ">="
33
36
  - !ruby/object:Gem::Version
34
- version: 3.0.0
37
+ version: 5.0.2
35
38
  type: :runtime
36
39
  prerelease: false
37
40
  version_requirements: !ruby/object:Gem::Requirement
38
41
  requirements:
42
+ - - "~>"
43
+ - !ruby/object:Gem::Version
44
+ version: '5.0'
39
45
  - - ">="
40
46
  - !ruby/object:Gem::Version
41
- version: 3.0.0
47
+ version: 5.0.2
42
48
  - !ruby/object:Gem::Dependency
43
49
  name: i18n
44
50
  requirement: !ruby/object:Gem::Requirement
45
51
  requirements:
46
- - - ">="
52
+ - - "~>"
47
53
  - !ruby/object:Gem::Version
48
- version: '0.6'
54
+ version: 0.8.1
49
55
  type: :runtime
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
52
58
  requirements:
53
- - - ">="
59
+ - - "~>"
54
60
  - !ruby/object:Gem::Version
55
- version: '0.6'
61
+ version: 0.8.1
56
62
  - !ruby/object:Gem::Dependency
57
63
  name: tzinfo
58
64
  requirement: !ruby/object:Gem::Requirement
59
65
  requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.2'
60
69
  - - ">="
61
70
  - !ruby/object:Gem::Version
62
- version: '0.3'
71
+ version: 1.2.3
63
72
  type: :runtime
64
73
  prerelease: false
65
74
  version_requirements: !ruby/object:Gem::Requirement
66
75
  requirements:
76
+ - - "~>"
77
+ - !ruby/object:Gem::Version
78
+ version: '1.2'
67
79
  - - ">="
68
80
  - !ruby/object:Gem::Version
69
- version: '0.3'
81
+ version: 1.2.3
70
82
  - !ruby/object:Gem::Dependency
71
83
  name: bourne
72
84
  requirement: !ruby/object:Gem::Requirement