Skip to content

Commit

Permalink
finish testing coverage of empty_subfields? method
Browse files Browse the repository at this point in the history
  • Loading branch information
mzelesky committed Nov 13, 2024
1 parent 84f729e commit b385897
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions spec/variable_fields/field_structure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,34 @@
RSpec.describe 'empty_subfields?' do
let(:record) { MARC::Record.new_from_hash('fields' => fields, 'leader' => leader) }
let(:leader) { '01104naa a2200289 i 4500' }
let(:fields) do
[
{ '245' => { 'ind1' => ' ',
'ind2' => ' ',
'subfields' => [{ 'a' => ' ' }, { 'b' => 'a tale' }] } }
]

context 'record has an empty subfield' do
let(:fields) do
[
{ '245' => { 'ind1' => ' ',
'ind2' => ' ',
'subfields' => [{ 'a' => ' ' }, { 'b' => 'a tale' }] } }
]
end

it 'finds an empty subfield' do
expect(MarcCleanup.empty_subfields?(record)).to eq true
end
end

it 'finds an empty subfield' do
expect(MarcCleanup.empty_subfields?(record)).to eq true
context 'record has no empty subfield' do
let(:fields) do
[
{ '245' => { 'ind1' => ' ',
'ind2' => ' ',
'subfields' => [{ 'a' => 'Headphones :' },
{ 'b' => 'a tale' }] } }
]
end

it 'does not trigger an error' do
expect(MarcCleanup.empty_subfields?(record)).to eq false
end
end
end

Expand Down

0 comments on commit b385897

Please sign in to comment.