<commit_before>require 'spec_helper'

describe Spree::Payment, :vcr do
  let(:order) { create(:avalara_order) }

  let(:gateway) do
    gateway = Spree::Gateway::Bogus.new( :active => true, :name => 'Bogus gateway')
    allow(gateway).to receive_messages :environment => 'test'
    allow(gateway).to receive_messages :source_required => true
    gateway
  end

  let(:card) do
    Spree::CreditCard.create!(
      number: '4111111111111111',
      month: '12',
      year: Time.now.year + 1,
      verification_value: '123',
      name: 'Name',
      imported: false
    )
  end

  let(:payment) do
    payment = Spree::Payment.new
    payment.source = card
    payment.order = order
    payment.payment_method = gateway
    payment.amount = order.total<commit_msg>Fix failing specs due to not saving payment<commit_after>require 'spec_helper'

describe Spree::Payment, :vcr do
  let(:order) { create(:avalara_order) }

  let(:gateway) do
    gateway = Spree::Gateway::Bogus.new( :active => true, :name => 'Bogus gateway')
    allow(gateway).to receive_messages :environment => 'test'
    allow(gateway).to receive_messages :source_required => true
    gateway
  end

  let(:card) do
    Spree::CreditCard.create!(
      number: '4111111111111111',
      month: '12',
      year: Time.now.year + 1,
      verification_value: '123',
      name: 'Name',
      imported: false
    )
  end

  let(:payment) do
    payment = Spree::Payment.new
    payment.source = card
    payment.order = order
    payment.payment_method = gateway
    payment.amount = order.total
    payment.save
{'fraction_non_alphanumeric': 0.12492073557387444, 'fraction_numerical': 0.027901077996195307, 'mean_word_length': 3.2880434782608696, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '7649140', 'n_tokens_mistral': 544, 'n_tokens_neox': 502, 'n_words': 119}