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