Sha256: b65dda11bc175981d38bc1640da2e82ef8d4cfbb21c9d2fc7cc7e2bc00e70a23

Contents?: true

Size: 1.09 KB

Versions: 32

Compression:

Stored size: 1.09 KB

Contents

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

describe Braintree::Discount do
  describe "self.all" do
    it "gets all discounts" do
      id = rand(36**8).to_s(36)

      expected = {
        :amount => "100.00",
        :description => "some description",
        :id => id,
        :kind => "discount",
        :name => "ruby_discount",
        :never_expires => false,
        :number_of_billing_cycles => 1
      }

      create_modification_for_tests(expected)

      discounts = Braintree::Discount.all
      discount = discounts.select { |discount| discount.id == id }.first

      discount.should_not be_nil
      discount.amount.should == BigDecimal(expected[:amount])
      discount.created_at.should_not be_nil
      discount.description.should == expected[:description]
      discount.kind.should == expected[:kind]
      discount.name.should == expected[:name]
      discount.never_expires.should == expected[:never_expires]
      discount.number_of_billing_cycles.should == expected[:number_of_billing_cycles]
      discount.updated_at.should_not be_nil
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
braintree-4.14.0 spec/integration/braintree/discount_spec.rb
braintree-4.13.0 spec/integration/braintree/discount_spec.rb
braintree-4.12.0 spec/integration/braintree/discount_spec.rb
braintree-4.11.0 spec/integration/braintree/discount_spec.rb
braintree-4.10.0 spec/integration/braintree/discount_spec.rb
braintree-4.9.0 spec/integration/braintree/discount_spec.rb
braintree-4.8.0 spec/integration/braintree/discount_spec.rb
braintree-4.7.0 spec/integration/braintree/discount_spec.rb
braintree-4.6.0 spec/integration/braintree/discount_spec.rb
braintree-4.5.0 spec/integration/braintree/discount_spec.rb
braintree-4.4.0 spec/integration/braintree/discount_spec.rb
braintree-4.3.0 spec/integration/braintree/discount_spec.rb
braintree-4.2.0 spec/integration/braintree/discount_spec.rb
braintree-4.1.0 spec/integration/braintree/discount_spec.rb
braintree-4.0.0 spec/integration/braintree/discount_spec.rb
braintree-3.4.0 spec/integration/braintree/discount_spec.rb
braintree-3.3.0 spec/integration/braintree/discount_spec.rb
braintree-3.2.0 spec/integration/braintree/discount_spec.rb
braintree-3.1.0 spec/integration/braintree/discount_spec.rb
braintree-3.0.1 spec/integration/braintree/discount_spec.rb