<commit_before>require 'spec_helper'
require 'vcr'
require 'webmock/rspec'
require 'nori'  # Available through Savon

describe "Collector::Client#activate_invoice" do
  before :all do
    @client = collector_client
    VCR.use_cassette('add_invoice') do
      response = @client.add_invoice(sandbox_invoice_request)
      @invoice_no = response.invoice_no
    end
  end
  it "performs an ActivateInvoice request" do
    VCR.use_cassette('activate_invoice') do
      response = @client.activate_invoice(invoice_no: @invoice_no,
                                          store_id: "355",
                                          country_code: "SE",
                                          correlation_id: "testing_activate_invoice")
      response.should be_kind_of Collector::InvoiceResponse
      response.correlation_id.should eq "testing_activate_invoice"
      response.payment_reference.should_not be_nil
      response.lowest_amount_to_pay.should eq "24.00"
      response.total_amount.should eq "24.00"
      expected_due_date = Time.now + 180*24*60*60
      response.due_date.to_time.should be_within(24*60*60).of(expected_due_date)<commit_msg>[FIX] Spec failing due to type error.<commit_after>require 'spec_helper'
require 'vcr'

describe "Collector::Client#activate_invoice" do
  before :all do
    @client = collector_client
    VCR.use_cassette('add_invoice') do
      response = @client.add_invoice(sandbox_invoice_request)
      @invoice_no = response.invoice_no
    end
  end
  it "performs an ActivateInvoice request" do
    VCR.use_cassette('activate_invoice') do
      response = @client.activate_invoice(invoice_no: @invoice_no,
                                          store_id: "355",
                                          country_code: "SE",
                                          correlation_id: "testing_activate_invoice")
      response.should be_kind_of Collector::InvoiceResponse
      response.correlation_id.should eq "testing_activate_invoice"
      response.payment_reference.should_not be_nil
      response.lowest_amount_to_pay.should eq "24.00"
      response.total_amount.should eq "24.00"
      expected_due_date = (Time.now + 180*24*60*60).to_f
      response.due_date.to_time.to_f.should be_within(24*60*60).of(expected_due_date)
{'fraction_non_alphanumeric': 0.08384547848990342, 'fraction_numerical': 0.0228270412642669, 'mean_word_length': 2.7857142857142856, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3819428', 'n_tokens_mistral': 723, 'n_tokens_neox': 681, 'n_words': 124}