Sha256: 76a855785273f1e4f9a373d41b8d406d3daeee20e4c7406bd3a4613cc94dd43c

Contents?: true

Size: 1.17 KB

Versions: 16

Compression:

Stored size: 1.17 KB

Contents

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

describe Braintree::ExchangeRateQuote do
  let(:rate_quote) do
    {
      id: "1234",
      base_amount: "10.00",
      exchange_rate: "74",
      quote_amount: "740"
    }
  end

  describe "#initialize" do
    it "initialize and sets the input keys to attrs variable" do
      quote = described_class.new(rate_quote)

      expect(quote.attrs).to include(:id)
      expect(quote.attrs).to include(:base_amount)
      expect(quote.attrs).to include(:exchange_rate)
      expect(quote.attrs).to include(:quote_amount)
      expect(quote.attrs.length).to eq(4)
    end
  end

  describe "inspect" do
    it "includes the id first" do
      output = described_class.new(id: "1234").inspect

      expect(output).to include("#<Braintree::ExchangeRateQuote id:\"1234\">")
    end

    it "includes all quote attributes" do
      quote = described_class.new(rate_quote)
      output = quote.inspect

      expect(output).to include("id:\"1234\"")
      expect(output).to include("base_amount:\"10.00\"")
      expect(output).to include("exchange_rate:\"74\"")
      expect(output).to include("quote_amount:\"740\"")
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
braintree-4.23.0 spec/unit/braintree/exchange_rate_quote_spec.rb
braintree-4.22.0 spec/unit/braintree/exchange_rate_quote_spec.rb
braintree-4.21.0 spec/unit/braintree/exchange_rate_quote_spec.rb
braintree-4.20.0 spec/unit/braintree/exchange_rate_quote_spec.rb
braintree-4.19.0 spec/unit/braintree/exchange_rate_quote_spec.rb
braintree-4.18.0 spec/unit/braintree/exchange_rate_quote_spec.rb
braintree-4.17.0 spec/unit/braintree/exchange_rate_quote_spec.rb
braintree-4.16.0 spec/unit/braintree/exchange_rate_quote_spec.rb
braintree-4.15.0 spec/unit/braintree/exchange_rate_quote_spec.rb
braintree-4.14.0 spec/unit/braintree/exchange_rate_quote_spec.rb
braintree-4.13.0 spec/unit/braintree/exchange_rate_quote_spec.rb
braintree-4.12.0 spec/unit/braintree/exchange_rate_quote_spec.rb
braintree-4.11.0 spec/unit/braintree/exchange_rate_quote_spec.rb
braintree-4.10.0 spec/unit/braintree/exchange_rate_quote_spec.rb
braintree-4.9.0 spec/unit/braintree/exchange_rate_quote_spec.rb
braintree-4.8.0 spec/unit/braintree/exchange_rate_quote_spec.rb