saucy 0.14.1 → 0.14.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.14.2
2
+
3
+ * Handle the case of nil billing_address
4
+
1
5
  0.14.1
2
6
 
3
7
  * Split up billing address form
@@ -13,12 +13,14 @@ class BillingsController < ApplicationController
13
13
  @account.expiration_month = @account.credit_card.expiration_month
14
14
  @account.expiration_year = @account.credit_card.expiration_year
15
15
 
16
- @account.street_address = @account.billing_address.street_address
17
- @account.extended_address = @account.billing_address.extended_address
18
- @account.locality = @account.billing_address.locality
19
- @account.region = @account.billing_address.region
20
- @account.postal_code = @account.billing_address.postal_code
21
- @account.country_name = @account.billing_address.country_name
16
+ if @account.billing_address
17
+ @account.street_address = @account.billing_address.street_address
18
+ @account.extended_address = @account.billing_address.extended_address
19
+ @account.locality = @account.billing_address.locality
20
+ @account.region = @account.billing_address.region
21
+ @account.postal_code = @account.billing_address.postal_code
22
+ @account.country_name = @account.billing_address.country_name
23
+ end
22
24
  end
23
25
 
24
26
  def update
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+
3
+ describe BillingsController, "#edit", :as => :account_admin do
4
+ def assigned_account
5
+ subject.instance_variable_get("@account")
6
+ end
7
+
8
+ let(:stub_credit_card) do
9
+ stub("credit card", {
10
+ :cardholder_name => "stub_cardholder_name",
11
+ :expiration_month => "stub_expiration_month",
12
+ :expiration_year => "stub_expiration_year",
13
+ })
14
+ end
15
+
16
+ let(:stub_customer) do
17
+ stub("customer", {
18
+ :email => "stub_email"
19
+ })
20
+ end
21
+
22
+ before do
23
+ account.stubs(:credit_card => stub_credit_card)
24
+ account.stubs(:customer => stub_customer)
25
+ Account.stubs(:find_by_keyword! => account)
26
+ end
27
+
28
+ context "for an account without a billing address" do
29
+ before do
30
+ account.stubs(:billing_address => nil)
31
+ get :edit, :account_id => account.keyword
32
+ end
33
+
34
+ it { should respond_with(:success) }
35
+ end
36
+
37
+ context "for an account with a billing address" do
38
+ let(:billing_address) do
39
+ stub("billing address", {
40
+ :street_address => 'stub_street_address',
41
+ :extended_address => 'stub_extended_address',
42
+ :locality => 'stub_locality',
43
+ :region => 'stub_region',
44
+ :postal_code => 'stub_postal_code',
45
+ :country_name => 'stub_country_name'
46
+ })
47
+ end
48
+
49
+ before do
50
+ account.stubs(:billing_address => billing_address)
51
+ get :edit, :account_id => account.keyword
52
+ end
53
+
54
+ it { should respond_with(:success) }
55
+
56
+ it "should set billing address fields" do
57
+ assigned_account.street_address.should == 'stub_street_address'
58
+ assigned_account.extended_address.should == 'stub_extended_address'
59
+ assigned_account.locality.should == 'stub_locality'
60
+ assigned_account.region.should == 'stub_region'
61
+ assigned_account.postal_code.should == 'stub_postal_code'
62
+ assigned_account.country_name.should == 'stub_country_name'
63
+ end
64
+ end
65
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: saucy
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.14.1
5
+ version: 0.14.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - thoughtbot, inc.
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-24 00:00:00 Z
18
+ date: 2011-10-28 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: clearance
@@ -257,6 +257,7 @@ files:
257
257
  - spec/controllers/admin/base_controller_spec.rb
258
258
  - spec/controllers/admin/users_controller_spec.rb
259
259
  - spec/controllers/application_controller_spec.rb
260
+ - spec/controllers/billings_controller_spec.rb
260
261
  - spec/controllers/invitations_controller_spec.rb
261
262
  - spec/controllers/memberships_controller_spec.rb
262
263
  - spec/controllers/plans_controller_spec.rb
@@ -328,6 +329,7 @@ test_files:
328
329
  - spec/controllers/admin/base_controller_spec.rb
329
330
  - spec/controllers/admin/users_controller_spec.rb
330
331
  - spec/controllers/application_controller_spec.rb
332
+ - spec/controllers/billings_controller_spec.rb
331
333
  - spec/controllers/invitations_controller_spec.rb
332
334
  - spec/controllers/memberships_controller_spec.rb
333
335
  - spec/controllers/plans_controller_spec.rb