Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilizes Valkyrie patterns for nested_collection_query_service_spec. #6488

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,35 @@
let(:another_collection_type) { create(:collection_type) }

let(:coll_a) do
create(:public_collection,
id: 'Collection_A',
valkyrie_create(:hyrax_collection, :public,
collection_type: collection_type)
end
let(:coll_b) do
create(:public_collection,
id: 'Collection_B',
valkyrie_create(:hyrax_collection, :public,
collection_type: collection_type,
member_of_collections: [coll_a])
member_of_collection_ids: [coll_a.id])
end
let(:coll_c) do
create(:public_collection,
id: 'Collection_C',
valkyrie_create(:hyrax_collection, :public,
collection_type: collection_type,
member_of_collections: [coll_b])
member_of_collection_ids: [coll_b.id])
end
let(:coll_d) do
create(:public_collection,
id: 'Collection_D',
valkyrie_create(:hyrax_collection, :public,
collection_type: collection_type,
member_of_collections: [coll_c])
member_of_collection_ids: [coll_c.id])
end
let(:coll_e) do
create(:public_collection,
id: 'Collection_E',
valkyrie_create(:hyrax_collection, :public,
collection_type: collection_type,
member_of_collections: [coll_d])
member_of_collection_ids: [coll_d.id])
end
let(:another) do
create(:public_collection,
id: 'Another_One',
valkyrie_create(:hyrax_collection, :public,
collection_type: collection_type)
end
let(:wrong) do
create(:public_collection,
id: 'Wrong_Type',
valkyrie_create(:hyrax_collection, :public,
collection_type: another_collection_type)
end

Expand Down Expand Up @@ -113,57 +106,45 @@

# using create option here because permission template is required for testing :deposit access
let(:coll_a) do
create(:public_collection_lw,
id: 'Collection_A',
valkyrie_create(:hyrax_collection, :public,
collection_type: collection_type,
user: user,
with_permission_template: true)
user: user)
end
let(:coll_b) do
create(:public_collection_lw,
id: 'Collection_B',
valkyrie_create(:hyrax_collection, :public,
collection_type: collection_type,
user: user,
with_permission_template: true,
member_of_collections: [coll_a])
member_of_collection_ids: [coll_a.id])
end
let(:coll_c) do
create(:public_collection_lw,
id: 'Collection_C',
valkyrie_create(:hyrax_collection, :public,
collection_type: collection_type,
user: user,
with_permission_template: true,
member_of_collections: [coll_b])
member_of_collection_ids: [coll_b.id])
end
let(:coll_d) do
create(:public_collection_lw,
id: 'Collection_D',
valkyrie_create(:hyrax_collection, :public,
collection_type: collection_type,
user: user,
with_permission_template: true,
member_of_collections: [coll_c])
member_of_collection_ids: [coll_c.id])
end
let(:coll_e) do
create(:public_collection_lw,
id: 'Collection_E',
valkyrie_create(:hyrax_collection, :public,

collection_type: collection_type,
user: user,
with_permission_template: true,
member_of_collections: [coll_d])
member_of_collection_ids: [coll_d.id])
end
let(:another) do
create(:public_collection_lw,
id: 'Another_One',
valkyrie_create(:hyrax_collection, :public,
collection_type: collection_type,
user: user,
with_permission_template: true)
user: user)
end
let(:wrong) do
create(:public_collection_lw,
id: 'Wrong_Type',
valkyrie_create(:hyrax_collection, :public,
collection_type: another_collection_type,
user: user,
with_permission_template: true)
user: user)
end

before do
Expand Down Expand Up @@ -205,18 +186,14 @@
describe 'and are of the same collection type' do
# using create option here because permission template is required for testing :deposit access
let!(:parent) do
create(:public_collection_lw,
id: 'Parent_Collecton',
valkyrie_create(:hyrax_collection, :public,
collection_type: collection_type,
user: user,
with_permission_template: true)
user: user)
end
let!(:child) do
create(:public_collection_lw,
id: 'Child_Collection',
valkyrie_create(:hyrax_collection, :public,
collection_type: collection_type,
user: user,
with_permission_template: true)
user: user)
end

it { is_expected.to eq(true) }
Expand All @@ -229,18 +206,21 @@
it { is_expected.to eq(false) }
end
describe 'and are of different collection types' do
before { allow(parent).to receive(:==).and_return(false) }
let(:parent) { double(nestable?: true, collection_type_gid: 'another', id: 'parent_collection') }

it { is_expected.to eq(false) }
end
end

describe 'given parent is not nestable?' do
before { allow(parent).to receive(:==).and_return(false) }
let(:parent) { double(nestable?: false, collection_type_gid: 'same', id: 'parent_collection') }

it { is_expected.to eq(false) }
end
describe 'given child is not nestable?' do
before { allow(parent).to receive(:==).and_return(false) }
let(:child) { double(nestable?: false, collection_type_gid: 'same', id: 'child_collection') }

it { is_expected.to eq(false) }
Expand Down