<commit_before>require 'spec_helper'

describe Spree::Gateway::BraintreeGateway do

  before(:each) do
    Spree::Gateway.update_all :active => false
    @gateway = Spree::Gateway::BraintreeGateway.create!(:name => "Braintree Gateway", :environment => "sandbox", :active => true)

    @gateway.set_preference(:merchant_id, "zbn5yzq9t7wmwx42" )
    @gateway.set_preference(:public_key, "<KEY>")
    @gateway.set_preference(:private_key, "<KEY>")
    @gateway.save!

    with_payment_profiles_off do
      @country = FactoryGirl.create(:country, :name => "United States", :iso_name => "UNITED STATES", :iso3 => "USA", :iso => "US", :numcode => 840)
      @state   = FactoryGirl.create(:state, :name => "Maryland", :abbr => "MD", :country => @country)
      @address = FactoryGirl.create(:address,
        :firstname => 'John',
        :lastname => 'Doe',
        :address1 => '1234 My Street',
        :address2 => 'Apt 1',
        :city =>  'Washington DC',
        :zipcode => '20123',
        :phone => '(555)555-5555',
        :state => @state,
        :country => @country
      )
      @order = FactoryGirl.create(:order_with_totals, :bill_address => @address, :ship_address => @address)
      @order.update!
      @credit_card = FactoryGirl.create(:credit_card, :verification_value => '123', :number => '5105105105105100', :month => 9, :year => Time.now.year + 1, :first_name => 'John', :last_name => 'Doe')
      @payment = FactoryGirl.create(:payment, :source => @credit_card, :order => @order, :payment_method => @gateway, :amount => 10.00)
      @payment.payment_method.environment = "test"
    end

  end

  it "should be braintree gateway" do
    @gateway.provider_class.should == ::ActiveMerchant::Billing::BraintreeBlueGateway
  end

  describe "preferences" do<commit_msg>Specify cc_type so that other tests in braintree_gateway_spec pass<commit_after>require 'spec_helper'

describe Spree::Gateway::BraintreeGateway do

  before(:each) do
    Spree::Gateway.update_all :active => false
    @gateway = Spree::Gateway::BraintreeGateway.create!(:name => "Braintree Gateway", :environment => "sandbox", :active => true)

    @gateway.set_preference(:merchant_id, "zbn5yzq9t7wmwx42" )
    @gateway.set_preference(:public_key, "<KEY>")
    @gateway.set_preference(:private_key, "<KEY>")
    @gateway.save!

    with_payment_profiles_off do
      @country = FactoryGirl.create(:country, :name => "United States", :iso_name => "UNITED STATES", :iso3 => "USA", :iso => "US", :numcode => 840)
      @state   = FactoryGirl.create(:state, :name => "Maryland", :abbr => "MD", :country => @country)
      @address = FactoryGirl.create(:address,
        :firstname => 'John',
        :lastname => 'Doe',
        :address1 => '1234 My Street',
        :address2 => 'Apt 1',
        :city =>  'Washington DC',
        :zipcode => '20123',
        :phone => '(555)555-5555',
        :state => @state,
        :country => @country
      )
      @order = FactoryGirl.create(:order_with_totals, :bill_address => @address, :ship_address => @address)
      @order.update!
      @credit_card = FactoryGirl.create(:credit_card, :verification_value => '123', :number => '5105105105105100', :month => 9, :year => Time.now.year + 1, :first_name => 'John', :last_name => 'Doe', :cc_type => 'mastercard')
      @payment = FactoryGirl.create(:payment, :source => @credit_card, :order => @order, :payment_method => @gateway, :amount => 10.00)
      @payment.payment_method.environment = "test"
    end

  end

  it "should be braintree gateway" do
    @gateway.provider_class.should == ::ActiveMerchant::Billing::BraintreeBlueGateway
  end

  describe "preferences" do
{'fraction_non_alphanumeric': 0.16543412763626403, 'fraction_numerical': 0.030676526978909886, 'mean_word_length': 3.8823529411764706, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 74, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6098213', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1195, 'n_words': 251}