Sha256: 79573418ed039fb5a12143888a7ba2de8d71f4e1208a2adff9b2f45c37849fb0
Contents?: true
Size: 1.69 KB
Versions: 4
Compression:
Stored size: 1.69 KB
Contents
require File.dirname(__FILE__) + "/../spec_helper" describe Braintree::Subscription do context "price" do it "accepts price as either a String or a BigDecimal" do Braintree::Subscription._new(:price => "12.34", :transactions => []).price.should == BigDecimal.new("12.34") Braintree::Subscription._new(:price => BigDecimal.new("12.34"), :transactions => []).price.should == BigDecimal.new("12.34") end it "blows up if price is not a string or BigDecimal" do expect { Braintree::Subscription._new(:price => 12.34, :transactions => []) }.to raise_error(/Argument must be a String or BigDecimal/) end end describe "self.search" do it "only allows specified values for status" do lambda do Braintree::Subscription.search do |search| search.status.in "Hammer" end end.should raise_error(ArgumentError) end end describe "==" do it "returns true for subscriptions with the same id" do subscription1 = Braintree::Subscription._new(:id => "123", :transactions => []) subscription2 = Braintree::Subscription._new(:id => "123", :transactions => []) subscription1.should == subscription2 end it "returns false for subscriptions with different ids" do subscription1 = Braintree::Subscription._new(:id => "123", :transactions => []) subscription2 = Braintree::Subscription._new(:id => "not_123", :transactions => []) subscription1.should_not == subscription2 end it "returns false if not comparing to a subscription" do subscription = Braintree::Subscription._new(:id => "123", :transactions => []) subscription.should_not == "not a subscription" end end end
Version data entries
4 entries across 4 versions & 1 rubygems