<commit_before>require 'spec_helper'

describe CamtParser::Format053::Statement do
  let(:camt)       { CamtParser::File.parse('spec/fixtures/valid_example.xml') }
  let(:statements) { camt.statements }
  let(:ex_stmt)    { camt.statements[0] }

  it "parses the statements properly into classes" do
    classes = statements.collect(&:class).uniq
    expect(classes.length).to eq(1)
    expect(classes.first).to eq(described_class)
  end

  it "contains certain attributes" do
    expect(ex_stmt.identification).to eq("0352C5320131227220503")
    expect(ex_stmt.generation_date.class).to eq(Time)
    expect(ex_stmt.from_date_time).to eq(nil)
    expect(ex_stmt.to_date_time).to eq(nil)
    expect(ex_stmt.account.class).to eq(CamtParser::Format053::Account)
    expect(ex_stmt.entries.class).to eq(Array)
  end

  describe CamtParser::Format053::Account do
    let(:account) { ex_stmt.account }

    it "parses the account properly into a class" do
      expect(account.iban).to eq("DE14740618130000033626")
      expect(account.bic).to eq("GENODEF1PFK")
      expect(account.bank_name).to eq("VR-Bank Rottal-Inn eG")
    end
  end

  describe CamtParser::Format053::Entry do
    let(:entries)  { ex_stmt.entries }
    let(:ex_entry) { ex_stmt.entries[0] }

    it "parses the entries properly into classes" do
      classes = entries.collect(&:class).uniq
      expect(classes.length).to eq(1)
      expect(classes.first).to eq(described_class)
    end

    it "contains certain attributes" do
      expect(ex_entry.amount.class).to eq(BigDecimal)
      expect(ex_entry.amount).to eq(BigDecimal.new('2'))
      expect(ex_entry.currency).to eq('EUR')
      expect(ex_entry.value_date.class).to eq(Date)
      expect(ex_entry.value_date).to eq(Date.new(2013, 12, 27))
      expect(ex_entry.creditor.class).to eq(CamtParser::Format053::Creditor)
      expect(ex_entry.debitor.class).to eq(CamtParser::Format053::Debitor)
      expect(ex_entry.remittance_information).to eq("TEST BERWEISUNG MITTELS BLZUND KONTONUMMER - DTA")
      expect(ex_entry.additional_information).to eq(
        "Überweisungs-Gutschrift; GVC: SEPA Credit Transfer (Einzelbuchung-Haben)"
      )
    end

    describe CamtParser::Format053::Debitor do
      let(:debitor) { ex_entry.debitor }

      it "contains certain attributes" do
        expect(debitor.name).to eq("<NAME>")
        expect(debitor.iban).to eq("DE24302201900609832118")
        expect(debitor.bic).to eq("DAAEDEDDXXX")
        expect(debitor.bank_name).to eq(nil)
      end
    end

    describe CamtParser::Format053::Creditor do
      let(:creditor) { ex_entry.creditor }<commit_msg>fix tests<commit_after>require 'spec_helper'

describe CamtParser::Format053::Statement do
  let(:camt)       { CamtParser::File.parse('spec/fixtures/valid_example.xml') }
  let(:statements) { camt.statements }
  let(:ex_stmt)    { camt.statements[0] }

  it "parses the statements properly into classes" do
    classes = statements.collect(&:class).uniq
    expect(classes.length).to eq(1)
    expect(classes.first).to eq(described_class)
  end

  it "contains certain attributes" do
    expect(ex_stmt.identification).to eq("0352C5320131227220503")
    expect(ex_stmt.generation_date.class).to eq(Time)
    expect(ex_stmt.from_date_time).to eq(nil)
    expect(ex_stmt.to_date_time).to eq(nil)
    expect(ex_stmt.account.class).to eq(CamtParser::Format053::Account)
    expect(ex_stmt.entries.class).to eq(Array)
  end

  describe CamtParser::Format053::Account do
    let(:account) { ex_stmt.account }

    it "parses the account properly into a class" do
      expect(account.iban).to eq("DE14740618130000033626")
      expect(account.bic).to eq("GENODEF1PFK")
      expect(account.bank_name).to eq("VR-Bank Rottal-Inn eG")
    end
  end

  describe CamtParser::Format053::Entry do
    let(:entries)  { ex_stmt.entries }
    let(:ex_entry) { ex_stmt.entries[0] }

    it "parses the entries properly into classes" do
      classes = entries.collect(&:class).uniq
      expect(classes.length).to eq(1)
      expect(classes.first).to eq(described_class)
    end

    it "contains certain attributes" do
      expect(ex_entry.amount.class).to eq(Float)
      expect(ex_entry.amount).to eq(BigDecimal.new('2'))
      expect(ex_entry.currency).to eq('EUR')
      expect(ex_entry.value_date.class).to eq(Date)
      expect(ex_entry.value_date).to eq(Date.new(2013, 12, 27))
      expect(ex_entry.creditor.class).to eq(CamtParser::Format053::Creditor)
      expect(ex_entry.debitor.class).to eq(CamtParser::Format053::Debitor)
      expect(ex_entry.remittance_information).to eq("TEST BERWEISUNG MITTELS BLZUND KONTONUMMER - DTA")
      expect(ex_entry.additional_information).to eq(
        "Überweisungs-Gutschrift; GVC: SEPA Credit Transfer (Einzelbuchung-Haben)"
      )
    end

    describe CamtParser::Format053::Debitor do
      let(:debitor) { ex_entry.debitor }

      it "contains certain attributes" do
        expect(debitor.name).to eq("<NAME>")
        expect(debitor.iban).to eq("DE24302201900609832118")
        expect(debitor.bic).to eq("DAAEDEDDXXX")
        expect(debitor.bank_name).to eq("")
      end
    end

    describe CamtParser::Format053::Creditor do
      let(:creditor) { ex_entry.creditor }
{'fraction_non_alphanumeric': 0.1253810975609756, 'fraction_numerical': 0.037347560975609755, 'mean_word_length': 3.8782527881040894, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '6708516', 'n_tokens_mistral': 1940, 'n_tokens_neox': 1763, 'n_words': 305}