Sha256: 16f87a24e53c806a7dc40c258ea46a0d6b52d3e87fece0f544936ac74f9b4415

Contents?: true

Size: 1.57 KB

Versions: 22

Compression:

Stored size: 1.57 KB

Contents

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

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

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

      create_modification_for_tests(expected)

      add_ons = Braintree::AddOn.all
      add_on = add_ons.select { |add_on| add_on.id == id }.first

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

    it "raises with a helpful error if public_key and private_key are not set" do
      gateway = Braintree::Gateway.new(
        :client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
        :client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
        :logger => Logger.new("/dev/null")
      )

      expect do
        gateway.add_on.all
      end.to raise_error(Braintree::ConfigurationError, /public_key and private_key are required/)
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
braintree-2.78.0 spec/integration/braintree/add_on_spec.rb
braintree-2.77.0 spec/integration/braintree/add_on_spec.rb
braintree-2.76.0 spec/integration/braintree/add_on_spec.rb
braintree-2.75.0 spec/integration/braintree/add_on_spec.rb
braintree-2.74.0 spec/integration/braintree/add_on_spec.rb
braintree-2.73.0 spec/integration/braintree/add_on_spec.rb
braintree-2.72.0 spec/integration/braintree/add_on_spec.rb
braintree-2.71.0 spec/integration/braintree/add_on_spec.rb
braintree-2.70.0 spec/integration/braintree/add_on_spec.rb
braintree-2.69.1 spec/integration/braintree/add_on_spec.rb
braintree-2.69.0 spec/integration/braintree/add_on_spec.rb
braintree-2.68.2 spec/integration/braintree/add_on_spec.rb
braintree-2.68.1 spec/integration/braintree/add_on_spec.rb
braintree-2.68.0 spec/integration/braintree/add_on_spec.rb
braintree-2.67.0 spec/integration/braintree/add_on_spec.rb
braintree-2.66.0 spec/integration/braintree/add_on_spec.rb
braintree-2.65.0 spec/integration/braintree/add_on_spec.rb
braintree-2.64.0 spec/integration/braintree/add_on_spec.rb
braintree-2.63.0 spec/integration/braintree/add_on_spec.rb
braintree-2.62.0 spec/integration/braintree/add_on_spec.rb