Sha256: b41ffea7ec33cd590fb287cc6f17cccee70f1ab035f03a00ef067e6eba95b974

Contents?: true

Size: 1.16 KB

Versions: 30

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe Chargify::Usage, :fake_resource do
  context "create" do
    before do
      @subscription = build(:subscription)
      @component = build(:component)
      @now = DateTime.now.to_s
    end
    
    it "should create a usage record" do
      u = Chargify::Usage.new
      u.subscription_id = @subscription.id
      u.component_id = @component.id
      u.quantity = 5
      u.memo = @now
      u.save
      
      usage = Chargify::Usage.find(:last, :params => {:subscription_id => @subscription.id, :component_id => @component.id})
      usage.memo.should == @now
      usage.quantity.should == 5
    end
  end
  
  context "find" do
    before do
      @subscription = build(:subscription)
      @component = build(:component)
      @now = DateTime.now.to_s
    end
    
    it "should return the usage" do
      u = Chargify::Usage.new
      u.subscription_id = @subscription.id
      u.component_id = @component.id
      u.quantity = 5
      u.memo = @now
      u.save
      
      usage = Chargify::Usage.find(:last, :params => {:subscription_id => @subscription.id, :component_id => @component.id})
      usage.quantity.should == 5
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
chargify_api_ares-1.4.15 spec/resources/usage_spec.rb
chargify_api_ares-1.4.14 spec/resources/usage_spec.rb
chargify_api_ares-1.4.13 spec/resources/usage_spec.rb
chargify_api_ares-1.4.11 spec/resources/usage_spec.rb
chargify_api_ares-1.4.10 spec/resources/usage_spec.rb
chargify_api_ares-1.4.7 spec/resources/usage_spec.rb
chargify_api_ares-1.4.6 spec/resources/usage_spec.rb
chargify_api_ares-1.4.5 spec/resources/usage_spec.rb
chargify_api_ares-1.4.4 spec/resources/usage_spec.rb
chargify_api_ares-1.4.3 spec/resources/usage_spec.rb
chargify_api_ares-1.4.2 spec/resources/usage_spec.rb
chargify_api_ares-1.4.1 spec/resources/usage_spec.rb
chargify_api_ares-1.4.0 spec/resources/usage_spec.rb
chargify_api_ares-1.3.5 spec/resources/usage_spec.rb
chargify_api_ares-1.3.4 spec/resources/usage_spec.rb
chargify_api_ares-1.3.3 spec/resources/usage_spec.rb
chargify_api_ares-1.3.2 spec/resources/usage_spec.rb
chargify_api_ares-1.3.1 spec/resources/usage_spec.rb
chargify_api_ares-1.3.0 spec/resources/usage_spec.rb
chargify_api_ares-1.2.1 spec/resources/usage_spec.rb