Sha256: 36d0b43433265827093aa4d6b347e4d0ba047ffc3590ee3de350b9cce181b605
Contents?: true
Size: 1.86 KB
Versions: 8
Compression:
Stored size: 1.86 KB
Contents
require 'spec_helper' describe BillingsController, "#edit", :as => :account_admin do def assigned_account subject.instance_variable_get("@account") end let(:stub_credit_card) do stub("credit card", { :cardholder_name => "stub_cardholder_name", :expiration_month => "stub_expiration_month", :expiration_year => "stub_expiration_year", }) end let(:stub_customer) do stub("customer", { :email => "stub_email" }) end before do account.stubs(:credit_card => stub_credit_card) account.stubs(:customer => stub_customer) Account.stubs(:find_by_keyword! => account) end context "for an account without a billing address" do before do account.stubs(:billing_address => nil) get :edit, :account_id => account.keyword end it { should respond_with(:success) } end context "for an account with a billing address" do let(:billing_address) do stub("billing address", { :street_address => 'stub_street_address', :extended_address => 'stub_extended_address', :locality => 'stub_locality', :region => 'stub_region', :postal_code => 'stub_postal_code', :country_name => 'stub_country_name' }) end before do account.stubs(:billing_address => billing_address) get :edit, :account_id => account.keyword end it { should respond_with(:success) } it "should set billing address fields" do assigned_account.street_address.should == 'stub_street_address' assigned_account.extended_address.should == 'stub_extended_address' assigned_account.locality.should == 'stub_locality' assigned_account.region.should == 'stub_region' assigned_account.postal_code.should == 'stub_postal_code' assigned_account.country_name.should == 'stub_country_name' end end end
Version data entries
8 entries across 8 versions & 1 rubygems