Sha256: a103be7e89d017403d093457ac342df90ac21f1443b8699c79c6d695d422821f
Contents?: true
Size: 1.49 KB
Versions: 15
Compression:
Stored size: 1.49 KB
Contents
require 'spec_helper' RSpec.describe Hydra::PCDM::AncestorChecker do context '.former_is_ancestor_of_latter?' do subject { described_class.former_is_ancestor_of_latter?(potential_ancestor, record) } let(:record) { instance_double(Hydra::PCDM::Object) } let(:potential_ancestor) { nil } context 'when the potential_ancestor is the record itself' do let(:potential_ancestor) { record } it { is_expected.to eq(true) } end context 'when the potential_ancestor has no members' do let(:potential_ancestor) { instance_double(Hydra::PCDM::Object, members: []) } it { is_expected.to eq(false) } end context 'when the potential_ancestor includes the given record' do let(:potential_ancestor) { instance_double(Hydra::PCDM::Object, members: [record]) } it { is_expected.to eq(true) } end context 'when the potential_ancestor includes a descendant that includes the given record' do let(:descendant) { instance_double(Hydra::PCDM::Object, members: [record]) } let(:potential_ancestor) { instance_double(Hydra::PCDM::Object, members: [descendant]) } it { is_expected.to eq(true) } end context 'when the potential_ancestor only includes descendants that do not include the given record' do let(:descendant) { instance_double(Hydra::PCDM::Object, members: [:another]) } let(:potential_ancestor) { instance_double(Hydra::PCDM::Object, members: [descendant]) } it { is_expected.to eq(false) } end end end
Version data entries
15 entries across 15 versions & 1 rubygems