Sha256: eb7e5fbe6ba6f868e71e976f4885ea708e19339538befcbe1c024dd41f68a283
Contents?: true
Size: 1.15 KB
Versions: 4
Compression:
Stored size: 1.15 KB
Contents
require 'spec_helper' describe Chargify::Usage do context "create" do before do @subscription = Factory(:subscription) @component = Factory(: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 = Factory(:subscription) @component = Factory(: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
4 entries across 4 versions & 1 rubygems