-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refine Hyrax::LeaseService behavior to find only enforced leases (#6330)
* refine Hyrax::LeaseService behavior to find only enforced leases repeats the work in #6241, but with the lease infrastructure. it would still be really nice to flatten these into one concept, but the data layer is still an issue (stored data has different names for functionally identical Embargo and Lease abstractions). * fin --------- Co-authored-by: Daniel Pierce <dlpierce@indiana.edu>
- Loading branch information
Showing
10 changed files
with
148 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,63 @@ | ||
# frozen_string_literal: true | ||
RSpec.describe Hyrax::LeasePresenter do | ||
subject(:presenter) { described_class.new(document) } | ||
let(:document) { SolrDocument.new(attributes) } | ||
let(:presenter) { described_class.new(document) } | ||
let(:attributes) { {} } | ||
|
||
describe "visibility" do | ||
describe "#visibility" do | ||
subject { presenter.visibility } | ||
|
||
it { is_expected.to eq 'restricted' } | ||
end | ||
|
||
describe "to_s" do | ||
describe "#to_s" do | ||
let(:attributes) { { 'title_tesim' => ['Hey guys!'] } } | ||
|
||
subject { presenter.to_s } | ||
|
||
it { is_expected.to eq 'Hey guys!' } | ||
end | ||
|
||
describe "human_readable_type" do | ||
describe "#human_readable_type" do | ||
let(:attributes) { { 'human_readable_type_tesim' => ['File'] } } | ||
|
||
subject { presenter.human_readable_type } | ||
|
||
it { is_expected.to eq 'File' } | ||
end | ||
|
||
describe "lease_expiration_date" do | ||
describe "#lease_expiration_date" do | ||
let(:attributes) { { 'lease_expiration_date_dtsi' => '2015-10-15T00:00:00Z' } } | ||
|
||
subject { presenter.lease_expiration_date } | ||
|
||
it { is_expected.to eq '15 Oct 2015' } | ||
end | ||
|
||
describe "visibility_after_lease" do | ||
describe "#visibility_after_lease" do | ||
let(:attributes) { { 'visibility_after_lease_ssim' => ['restricted'] } } | ||
|
||
subject { presenter.visibility_after_lease } | ||
|
||
it { is_expected.to eq 'restricted' } | ||
end | ||
|
||
describe "lease_history" do | ||
describe "#lease_history" do | ||
let(:attributes) { { 'lease_history_ssim' => ['This is in the past'] } } | ||
|
||
subject { presenter.lease_history } | ||
|
||
it { is_expected.to eq ['This is in the past'] } | ||
end | ||
|
||
describe "#enforced?" do | ||
let(:attributes) do | ||
{ "lease_expiration_date_dtsi" => "2023-08-30T00:00:00Z", | ||
"visibility_during_lease_ssim" => "open", | ||
"visibility_after_lease_ssim" => "restricted", | ||
"visibility_ssi" => "open" } | ||
end | ||
|
||
it { is_expected.to be_enforced } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters