Skip to content

Commit

Permalink
make SingleUseLinksController use valkyrie for spec setup
Browse files Browse the repository at this point in the history
  • Loading branch information
tamsin johnson authored and tamsin johnson committed Aug 29, 2023
1 parent 0aa7bf8 commit f576b42
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions spec/controllers/hyrax/single_use_links_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
RSpec.describe Hyrax::SingleUseLinksController, type: :controller do
routes { Hyrax::Engine.routes }

let(:user) { create(:user) }
let(:file) { create(:file_set, user: user) }
let(:user) { FactoryBot.create(:user) }
let(:file) do
FactoryBot.valkyrie_create(:hyrax_file_set,
depositor: user.user_key,
edit_users: [user])
end

describe "::show_presenter" do
subject { described_class }
Expand Down Expand Up @@ -56,8 +60,12 @@
end

describe "logged in user without edit permission" do
let(:other_user) { create(:user) }
let(:file) { create(:file_set, user: user, read_users: [other_user]) }
let(:other_user) { FactoryBot.create(:user) }
let(:file) do
FactoryBot.valkyrie_create(:hyrax_file_set,
depositor: user.user_key,
read_users: [other_user])
end

before { sign_in other_user }
subject { response }
Expand Down

0 comments on commit f576b42

Please sign in to comment.