-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #481 from sul-dlss/t478-collections_dashboard
- Loading branch information
Showing
8 changed files
with
58 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe User do | ||
let(:user) { create(:user) } | ||
let!(:managed_collection) { create(:collection, managers: [user]) } | ||
let!(:depositor_collection) { create(:collection, depositors: [user]) } | ||
let!(:reviewed_collection) { create(:collection, reviewers: [user]) } | ||
let!(:deduped_collection) { create(:collection, managers: [user], depositors: [user], reviewers: [user]) } | ||
|
||
describe '.your_collections' do | ||
before do | ||
# Not your collection | ||
create(:collection, user:) | ||
end | ||
|
||
it 'returns the collections for which the user is a manager, depositor, or reviewer' do | ||
expect(user.your_collections).to contain_exactly(managed_collection, depositor_collection, reviewed_collection, | ||
deduped_collection) | ||
end | ||
end | ||
|
||
describe '.your_works' do | ||
let!(:managed_work) { create(:work, collection: managed_collection) } | ||
let!(:depositor_work) { create(:work, collection: depositor_collection) } | ||
let!(:reviewed_work) { create(:work, collection: reviewed_collection) } | ||
|
||
before do | ||
# Not your work | ||
create(:work, collection: create(:collection, user:)) | ||
end | ||
|
||
it 'returns the works that are part of the your collections' do | ||
expect(user.your_works).to contain_exactly(managed_work, depositor_work, reviewed_work) | ||
end | ||
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
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