Skip to content

Commit

Permalink
refactor Hyrax::LeaseHelper specs to work under koppie
Browse files Browse the repository at this point in the history
some of these tests ensure interactions with AF models, these can be disabled.

others needed to be refactored to use Valkyrie for setup.
  • Loading branch information
tamsin johnson committed Aug 24, 2023
1 parent 4720476 commit 1e20cae
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions spec/helpers/hyrax/lease_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

RSpec.describe Hyrax::LeaseHelper do
let(:resource) { build(:monograph) }
let(:resource) { FactoryBot.build(:monograph) }

describe 'lease_enforced?' do
# Including this stub to preserve the spec structure before the #4845 change
Expand Down Expand Up @@ -77,7 +77,7 @@
end
end

context 'with an ActiveFedora resource' do
context 'with an ActiveFedora resource', :active_fedora do
let(:resource) { build(:work) }

it 'returns false' do
Expand Down Expand Up @@ -106,7 +106,7 @@
end
end

context 'with a HydraEditor::Form' do
context 'with a HydraEditor::Form', :active_fedora do
let(:resource) { Hyrax::GenericWorkForm.new(model, ability, form_controller) }
let(:model) { build(:work) }
let(:ability) { :FAKE_ABILITY }
Expand All @@ -129,17 +129,15 @@

context 'with a Hyrax::Forms::FailedSubmissionFormWrapper' do
let(:resource) { Hyrax::Forms::FailedSubmissionFormWrapper.new(form: form, input_params: {}, permitted_params: {}) }
let(:model) { build(:work) }
let(:form) { Hyrax::GenericWorkForm.new(model, ability, form_controller) }
let(:ability) { :FAKE_ABILITY }
let(:form_controller) { :FAKE_CONTROLLER }
let(:model) { FactoryBot.build(:hyrax_work) }
let(:form) { Hyrax::Forms::ResourceForm.for(model) }

it 'returns false' do
expect(lease_enforced?(resource)).to be false
end

context 'when the wrapped work is under embargo' do
let(:model) { build(:leased_work) }
let(:model) { FactoryBot.build(:hyrax_work, :under_lease) }

it 'returns true' do
# This allow call is a tweak to preserve spec for pre #4845 patch
Expand All @@ -151,7 +149,7 @@
end

describe '#lease_history' do
context 'with an ActiveFedora resource' do
context 'with an ActiveFedora resource', :active_fedora do
let(:resource) { FactoryBot.build(:work) }

it 'is empty' do
Expand Down

0 comments on commit 1e20cae

Please sign in to comment.