Skip to content
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.

Commit

Permalink
Merge pull request #117 from CDL-Dryad/peer-review
Browse files Browse the repository at this point in the history
added tests for peer-review
  • Loading branch information
briri authored Jun 17, 2019
2 parents 713f0a6 + 247edff commit 801c58d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/features/stash_datacite/review_dataset_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,15 @@

end

context :peer_review_section do

it 'should be visible', js: true do
start_new_dataset
navigate_to_review
expect(page).to have_content('Enable Private for Peer Review')
end

end

end
# rubocop:enable Metrics/BlockLength
33 changes: 33 additions & 0 deletions spec/models/stash_engine/resources_spec.rb
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

0 comments on commit 801c58d

Please sign in to comment.