<commit_before>require 'test_helper'

class CardSaveTest < Test::Unit::TestCase
  def setup
    Base.gateway_mode = :test
    @gateway = CardSaveGateway.new(login:'login', password:'password')
    @credit_card = credit_card
    @amount = 100    
    @options = {order_id:'1', billing_address:address, description:'Store Purchase'}
  end
  
  def test_successful_purchase
    @gateway.expects(:ssl_post).returns(successful_visa_no_3d_purchase_response)
    
    assert response = @gateway.purchase(@amount, @credit_card, @options)
    assert_success response
    
    # Replace with authorization number from the successful response
    assert_equal '1;110706093540191601939772;939772', response.authorization
    assert response.test?
  end

  def test_unsuccessful_request
    @gateway.expects(:ssl_post).returns(declined_switch_no_3d_purchase_response)

    assert response = @gateway.purchase(@amount, @credit_card, @options)<commit_msg>Removing Ruby 1.9 specific hash syntax<commit_after>require 'test_helper'

class CardSaveTest < Test::Unit::TestCase
  def setup
    Base.gateway_mode = :test
    @gateway = CardSaveGateway.new(:login => 'login', :password => 'password')
    @credit_card = credit_card
    @amount = 100    
    @options = {:order_id =>'1', :billing_address => address, :description =>'Store Purchase'}
  end
  
  def test_successful_purchase
    @gateway.expects(:ssl_post).returns(successful_visa_no_3d_purchase_response)
    
    assert response = @gateway.purchase(@amount, @credit_card, @options)
    assert_success response
    
    # Replace with authorization number from the successful response
    assert_equal '1;110706093540191601939772;939772', response.authorization
    assert response.test?
  end

  def test_unsuccessful_request
    @gateway.expects(:ssl_post).returns(declined_switch_no_3d_purchase_response)

    assert response = @gateway.purchase(@amount, @credit_card, @options)
{'fraction_non_alphanumeric': 0.09620384815392616, 'fraction_numerical': 0.039521580863234526, 'mean_word_length': 4.956656346749226, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '5030161', 'n_tokens_mistral': 648, 'n_tokens_neox': 593, 'n_words': 117}