-
Notifications
You must be signed in to change notification settings - Fork 2
/
work_spec.rb
39 lines (27 loc) · 1.05 KB
/
work_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe LibPtgBox::Work do
subject(:work) { described_class.new(selection, kbart) }
let(:selection) { instance_double(LibPtgBox::Selection, 'selection', collection: collection) }
let(:collection) { instance_double(LibPtgBox::Collection, 'collection', catalog: catalog) }
let(:catalog) { instance_double(LibPtgBox::Catalog, 'catalog') }
let(:kbart) { instance_double(LibPtgBox::Unmarshaller::Kbart, 'kbart', doi: 'doi') }
let(:marc) { nil }
before { allow(catalog).to receive(:marc).with('doi').and_return(marc) }
describe 'marc?' do
subject { work.marc? }
it { is_expected.to be false }
context 'with marc' do
let(:marc) { instance_double(LibPtgBox::Unmarshaller::Marc, 'marc') }
it { is_expected.to be true }
end
end
describe 'marc' do
subject { work.marc }
it { is_expected.to be_nil }
context 'with marc' do
let(:marc) { instance_double(LibPtgBox::Unmarshaller::Marc, 'marc') }
it { is_expected.to be marc }
end
end
end