# == Schema Information # # Table name: billing_informations # # id :integer(4) not null, primary key # billable_id :integer(4) # billable_type :string(255) # first_name :string(128) default(""), not null # last_name :string(128) default(""), not null # address1 :string(512) default(""), not null # address2 :string(512) # city :string(128) default(""), not null # state_id :integer(4) # country_id :integer(4) # postal_code :string(255) default(""), not null # telephone :string(255) default(""), not null # payment_method :string(255) default("CC") # credit_card_type :string(255) # credit_card_last_digits :string(4) # credit_card_expiration :datetime # achname :string(1024) # achrouting :string(1024) # achnumber :string(1024) # achholder :string(1024) # achtype :string(64) # vault_id :string(512) # customer_profile_id :string(512) # customer_payment_profile_id :string(512) # default :boolean(1) # created_at :datetime # updated_at :datetime # name :string(256) # company :string(256) # require File.dirname(__FILE__) + '/../test_helper' class BillingInformationTest < ActiveSupport::TestCase context 'A billing_information instance that acts_as_muck_billing_information' do setup do @billing_information = Factory(:billing_information) end subject { @billing_information } should_belong_to :billable should_belong_to :state should_belong_to :country should_validate_presence_of :credit_card_number should_validate_presence_of :credit_card_expiration should_validate_presence_of :achname should_validate_presence_of :achrouting should_validate_presence_of :achnumber should_validate_presence_of :verification_value should "have verification value" do assert_not_nil @billing_information.verification_value end context "named scope" do should_scope_by_newest context "scope by default" do @default = Factory(:billing_information, :default => true) @non_default = Factory(:billing_information, :default => false) end should "find default" do assert BillingInformation.default.include?(@default) end should "not find nondefault" do assert BillingInformation.default.include?(@non_default) end end end end