Sha256: 9d8f9f62bd4e6b4be9f053e0a44889fce79f9947cbfa446dec16045086573d90

Contents?: true

Size: 846 Bytes

Versions: 5

Compression:

Stored size: 846 Bytes

Contents

require 'spec_helper'

describe BillingActivity do
  it { should belong_to :subscription }
  it { should have_one :invoice }
  
  describe 'on charge' do
    before(:each) do
       plan = Factory.build(:plan, :name => "Gold", :price => 20)
       contact_info = Factory.build(:contact_info)
  
       credit_card = Factory.build(:credit_card)
       @subscription = Factory(:subscription, :contact_info => contact_info, :plan => plan, :credit_card => credit_card)
    end
    
    it 'should create a new billing activity on successful charge' do
      @subscription.bill!
      @subscription.billing_activities.count.should == 2
    
    end
    
    it 'should create link to invoice in message if it has an invoice' do
      @subscription.invoice!
      @subscription.billing_activities.last.message.should include "<a href"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
saasaparilla-0.2.2 spec/models/billing_activity_spec.rb
saasaparilla-0.2.1 spec/models/billing_activity_spec.rb
saasaparilla-0.1.8 spec/models/billing_activity_spec.rb
saasaparilla-0.1.7 spec/models/billing_activity_spec.rb
saasaparilla-0.1.6 spec/models/billing_activity_spec.rb