From 3709bbfd091df97262e52677cd2d5f4c60687809 Mon Sep 17 00:00:00 2001 From: Beck Davis Date: Wed, 22 Nov 2023 12:59:29 -0500 Subject: [PATCH] Test and fixture for book_008 method --- spec/fixed_fields/book_bad_008_spec.rb | 15 +++++++++++++++ .../fixed_fields/marc_with_bad_book_008.xml | 14 ++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 spec/fixed_fields/book_bad_008_spec.rb create mode 100644 spec/fixtures/fixed_fields/marc_with_bad_book_008.xml diff --git a/spec/fixed_fields/book_bad_008_spec.rb b/spec/fixed_fields/book_bad_008_spec.rb new file mode 100644 index 0000000..b14f46e --- /dev/null +++ b/spec/fixed_fields/book_bad_008_spec.rb @@ -0,0 +1,15 @@ +require 'nokogiri' +require 'marc' +require 'byebug' +require 'marc_cleanup' + +RSpec.describe 'test bad_008?' do + describe 'bad book format 008' do + let(:marcfile) {"#{Dir.getwd}/spec/fixtures/fixed_fields/marc_with_bad_book_008.xml"} + let(:reader) { MARC::XMLReader.new(marcfile, parser: 'magic') } + let(:record_with_bad_008) { reader.first } + it 'knows that a record with bad book 008 is invalid' do + expect(MarcCleanup.bad_008?(record_with_bad_008)).to eq true + end + end +end \ No newline at end of file diff --git a/spec/fixtures/fixed_fields/marc_with_bad_book_008.xml b/spec/fixtures/fixed_fields/marc_with_bad_book_008.xml new file mode 100644 index 0000000..5fa546a --- /dev/null +++ b/spec/fixtures/fixed_fields/marc_with_bad_book_008.xml @@ -0,0 +1,14 @@ + + + + 01104naa a2200289 i 4500 + 99127156537506421 + 230519s1996 njua u 000 0 eng d + + PPPL highlights : + Princeton Plasma Physics Laboratory. + + + \ No newline at end of file