Sha256: ec844650575cf6911b63f70b3c9bd57c2429ff7bcea409b7d39d2fdf9e017d67

Contents?: true

Size: 1.21 KB

Versions: 16

Compression:

Stored size: 1.21 KB

Contents

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

module Braintree
  describe ClientToken do
    describe "self.generate" do
      it "delegates to ClientTokenGateway#generate" do
        options = {:foo => :bar}
        client_token_gateway = double(:client_token_gateway)
        client_token_gateway.should_receive(:generate).with(options).once
        ClientTokenGateway.stub(:new).and_return(client_token_gateway)
        ClientToken.generate(options)
      end

      it "can't overwrite public_key, or created_at" do
        expect {
          client_token = Braintree::ClientToken.generate(
            :public_key => "bad_key",
            :created_at => "bad_time",
          )
        }.to raise_error(ArgumentError, /created_at, public_key/)
      end
    end

    context "adding credit_card options with no customer ID" do
      %w(verify_card fail_on_duplicate_payment_method make_default).each do |option_name|
        it "raises an ArgumentError if #{option_name} is present" do
          expect do
            Braintree::ClientToken.generate(
              option_name.to_sym => true,
            )
          end.to raise_error(ArgumentError, /#{option_name}/)
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
braintree-4.14.0 spec/unit/braintree/client_token_spec.rb
braintree-4.13.0 spec/unit/braintree/client_token_spec.rb
braintree-4.12.0 spec/unit/braintree/client_token_spec.rb
braintree-4.11.0 spec/unit/braintree/client_token_spec.rb
braintree-4.10.0 spec/unit/braintree/client_token_spec.rb
braintree-4.9.0 spec/unit/braintree/client_token_spec.rb
braintree-4.8.0 spec/unit/braintree/client_token_spec.rb
braintree-4.7.0 spec/unit/braintree/client_token_spec.rb
braintree-4.6.0 spec/unit/braintree/client_token_spec.rb
braintree-4.5.0 spec/unit/braintree/client_token_spec.rb
braintree-4.4.0 spec/unit/braintree/client_token_spec.rb
braintree-4.3.0 spec/unit/braintree/client_token_spec.rb
braintree-4.2.0 spec/unit/braintree/client_token_spec.rb
braintree-4.1.0 spec/unit/braintree/client_token_spec.rb
braintree-4.0.0 spec/unit/braintree/client_token_spec.rb
braintree-3.4.0 spec/unit/braintree/client_token_spec.rb