Skip to content

Commit e6378d4

Browse files
tamsin johnsontamsin johnson
tamsin johnson
authored and
tamsin johnson
committed
use valkyrie for setup in fixity_checks_controller_spec
related to #6304. this still leaves one of these tests failing, since this controller doesn't actually support valkyrie, but the setup is correct at least.
1 parent b872466 commit e6378d4

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

spec/controllers/hyrax/fixity_checks_controller_spec.rb

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
# frozen_string_literal: true
22
RSpec.describe Hyrax::FixityChecksController do
33
routes { Hyrax::Engine.routes }
4-
let(:user) { create(:user) }
5-
let(:file_set) { create(:file_set, user: user) }
6-
let(:binary) { File.open(fixture_path + '/world.png') }
7-
let(:file) { Hydra::Derivatives::IoDecorator.new(binary, 'image/png', 'world.png') }
8-
9-
before { Hydra::Works::UploadFileToFileSet.call(file_set, file) }
10-
4+
let(:user) { FactoryBot.create(:user) }
5+
let(:file_set) { FactoryBot.valkyrie_create(:hyrax_file_set, :with_files, depositor: user.user_key) }
116
context "when signed in" do
127
describe "POST create" do
13-
before do
14-
sign_in user
15-
post :create, params: { file_set_id: file_set }, xhr: true
16-
end
8+
before { sign_in user }
9+
1710
let(:json_response) { JSON.parse(response.body) }
1811

1912
it "returns json with the result" do
13+
post :create, params: { file_set_id: file_set }, xhr: true
14+
2015
expect(response).to be_successful
2116
# json is a structure like this:
2217
# { file_id => [{ "checked_uri" => "...4-4d71-83ba-1bc52a5e4300/fcr:versions/version1", "passed" => true },
@@ -38,6 +33,7 @@
3833
describe "POST create" do
3934
it "returns json with the result" do
4035
post :create, params: { file_set_id: file_set }, xhr: true
36+
4137
expect(response.code).to eq '401'
4238
end
4339
end

0 commit comments

Comments
 (0)