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

Removes FileSet related objects when work deleted (#6334). #6357

Merged
merged 16 commits into from
Oct 17, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
adds rspec.
  • Loading branch information
bwatson78 committed Oct 16, 2023
commit 97cdd41e512455df4617fa5efb6df266a3ef38a3
12 changes: 12 additions & 0 deletions spec/hyrax/transactions/file_set_destroy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
describe '#call' do
let(:user) { FactoryBot.create(:user) }

before do
file_set.permission_manager.read_users = [user.user_key]
file_set.permission_manager.acl.save
end

context 'without a user' do
it 'is a failure' do
expect(transaction.call(file_set)).to be_failure
Expand All @@ -28,6 +33,13 @@
.to raise_error Valkyrie::Persistence::ObjectNotFoundError
end

it 'deletes the access control resource' do
expect { transaction.with_step_args('file_set.remove_from_work' => { user: user }).call(file_set) }
.to change { Hyrax::AccessControl.for(resource: file_set).persisted? }
.from(true)
.to(false)
end

context "with attached files" do
let(:work) { FactoryBot.valkyrie_create(:hyrax_work, uploaded_files: [FactoryBot.create(:uploaded_file)], edit_users: [user]) }
let(:file_set) { query_service.find_members(resource: work).first }
Expand Down