This repository has been archived by the owner on Nov 20, 2019. It is now read-only.
forked from CDLUC3/dashv2
-
Notifications
You must be signed in to change notification settings - Fork 9
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 #117 from CDL-Dryad/peer-review
added tests for peer-review
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'rails_helper' | ||
|
||
module StashEngine | ||
|
||
RSpec.describe Resource, type: :model do | ||
|
||
context 'peer_review' do | ||
|
||
describe :requires_peer_review? do | ||
let!(:resource) { create(:resource, identifier: create(:identifier)) } | ||
|
||
it 'returns false if hold_for_peer_review flag is not set' do | ||
expect(resource.send(:requires_peer_review?)).to eql(false) | ||
end | ||
it 'returns true if hold_for_peer_review flag is set' do | ||
resource.hold_for_peer_review = true | ||
expect(resource.send(:requires_peer_review?)).to eql(true) | ||
end | ||
it 'returns false if hold_for_peer_review flag is not set and there is no publication defined' do | ||
expect(resource.send(:requires_peer_review?)).to eql(false) | ||
end | ||
it 'returns true if hold_for_peer_review flag is not set but there is a publication defined' do | ||
resource.identifier.internal_data << create(:internal_datum, data_type: 'publicationDOI') | ||
expect(resource.send(:requires_peer_review?)).to eql(true) | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end |