Sha256: 7ca7ebf7199558a520b00079465c774f9d919aa91f4a669b548918a0087f97d5

Contents?: true

Size: 1.52 KB

Versions: 8

Compression:

Stored size: 1.52 KB

Contents

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

describe Braintree::Dispute, "search" do
  context "advanced" do
    it "correctly returns a result with no matches" do
      collection = Braintree::Dispute.search do |search|
        search.id.is "non_existent_dispute"
      end

      expect(collection.disputes.count).to eq(0)
    end

    it "correctly returns a single dispute by id" do
      collection = Braintree::Dispute.search do |search|
        search.id.is "open_dispute"
      end

      expect(collection.disputes.count).to eq(1)
      dispute = collection.disputes.first

      expect(dispute.id).to eq("open_dispute")
      expect(dispute.status).to eq(Braintree::Dispute::Status::Open)
    end

    it "correctly returns disputes by multiple reasons" do
      collection = Braintree::Dispute.search do |search|
        search.reason.in [
          Braintree::Dispute::Reason::ProductUnsatisfactory,
          Braintree::Dispute::Reason::Retrieval
        ]
      end

      expect(collection.disputes.count).to eq(2)
      dispute = collection.disputes.first
    end

    it "correctly returns disputes by received_date range" do
      collection = Braintree::Dispute.search do |search|
        search.received_date.between("03/03/2014", "03/05/2014")
      end

      expect(collection.disputes.count).to eq(1)
      dispute = collection.disputes.first

      expect(dispute.received_date).to eq(Date.new(2014, 3, 4))
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
braintree-2.83.0 spec/integration/braintree/dispute_search_spec.rb
braintree-2.82.0 spec/integration/braintree/dispute_search_spec.rb
braintree-2.81.0 spec/integration/braintree/dispute_search_spec.rb
braintree-2.80.1 spec/integration/braintree/dispute_search_spec.rb
braintree-2.80.0 spec/integration/braintree/dispute_search_spec.rb
braintree-2.79.0 spec/integration/braintree/dispute_search_spec.rb
braintree-2.78.0 spec/integration/braintree/dispute_search_spec.rb
braintree-2.77.0 spec/integration/braintree/dispute_search_spec.rb