Sha256: 5d1d3652e79763c82c9fa4cf981449b847388b388403099b8cb35e354a557022

Contents?: true

Size: 909 Bytes

Versions: 7

Compression:

Stored size: 909 Bytes

Contents

require File.dirname(__FILE__) + "/../spec_helper"

module Braintree
  describe SubscriptionSearch do
    context "status" do
      it "allows Active, Canceled and PastDue" do
        search = SubscriptionSearch.new

        lambda do
          search.status.in(
            Subscription::Status::Active,
            Subscription::Status::Canceled,
            Subscription::Status::PastDue
          )
        end.should_not raise_error
      end
    end

    context "days_past_due" do
      it "correctly builds a hash with the criteria" do
        search = SubscriptionSearch.new
        search.days_past_due.is "30"

        search.to_hash.should == {:days_past_due => {:is => "30"}}
      end

      it "coverts ints to strings" do
        search = SubscriptionSearch.new
        search.days_past_due.is 30

        search.to_hash.should == {:days_past_due => {:is => "30"}}
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
braintree-2.4.0 spec/unit/braintree/subscription_search_spec.rb
braintree-2.3.1 spec/unit/braintree/subscription_search_spec.rb
braintree-2.2.0 spec/unit/braintree/subscription_search_spec.rb
braintree-2.1.0 spec/unit/braintree/subscription_search_spec.rb
braintree-2.0.0 spec/unit/braintree/subscription_search_spec.rb
braintree-1.2.1 spec/unit/braintree/subscription_search_spec.rb
braintree-1.2.0 spec/unit/braintree/subscription_search_spec.rb