Sha256: 0c869ebe4b138eb50256a7d454d1470bfa57cc7d85221744c272370684837db6

Contents?: true

Size: 957 Bytes

Versions: 9

Compression:

Stored size: 957 Bytes

Contents

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

describe Braintree::TransactionSearch do
  it "overrides previous 'is' with new 'is' for the same field" do
    search = Braintree::TransactionSearch.new
    search.billing_company.is "one"
    search.billing_company.is "two"
    expect(search.to_hash).to eq({:billing_company => {:is => "two"}})
  end

  it "overrides previous 'in' with new 'in' for the same field" do
    search = Braintree::TransactionSearch.new
    search.status.in Braintree::Transaction::Status::Authorized
    search.status.in Braintree::Transaction::Status::SubmittedForSettlement
    expect(search.to_hash).to eq({:status => [Braintree::Transaction::Status::SubmittedForSettlement]})
  end

  it "raises if the operator 'is' is left off" do
    search = Braintree::TransactionSearch.new
    expect do
      search.billing_company "one"
    end.to raise_error(RuntimeError, "An operator is required")
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
braintree-4.23.0 spec/unit/braintree/transaction_search_spec.rb
braintree-4.22.0 spec/unit/braintree/transaction_search_spec.rb
braintree-4.21.0 spec/unit/braintree/transaction_search_spec.rb
braintree-4.20.0 spec/unit/braintree/transaction_search_spec.rb
braintree-4.19.0 spec/unit/braintree/transaction_search_spec.rb
braintree-4.18.0 spec/unit/braintree/transaction_search_spec.rb
braintree-4.17.0 spec/unit/braintree/transaction_search_spec.rb
braintree-4.16.0 spec/unit/braintree/transaction_search_spec.rb
braintree-4.15.0 spec/unit/braintree/transaction_search_spec.rb