• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / pdc_discovery / 2ac48f63-1531-4c4d-b0c7-21f5447613b7

12 Sep 2024 05:36PM UTC coverage: 97.189% (+0.1%) from 97.054%
2ac48f63-1531-4c4d-b0c7-21f5447613b7

push

circleci

web-flow
Fix coverage reporting by using coveralls circleci orb (#680)

3457 of 3557 relevant lines covered (97.19%)

286.43 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.88
/spec/system/embargoed_document_spec.rb
1
# frozen_string_literal: true
2
require 'rails_helper'
1✔
3

4
describe 'Embargoed Document page', type: :system, js: true do
1✔
5
  context "when the Solr Document has an embargo date" do
1✔
6
    # This redundancy is required for consistent testing
7
    let(:embargo_resource) { item_file_fixture.read }
3✔
8
    let(:rss_feed) { file_fixture("works.rss").read }
3✔
9
    let(:rss_url) { "https://pdc-describe-prod.princeton.edu/describe/works.rss" }
3✔
10
    let(:indexer) { DescribeIndexer.new(rss_url: rss_url) }
3✔
11
    let(:solr_response) do
1✔
12
      Blacklight.default_index.connection.get 'select', params: { q: '*:*' }
×
13
    end
14

15
    before do
1✔
16
      stub_request(:get, "https://pdc-describe-prod.princeton.edu/describe/works.rss")
2✔
17
        .to_return(status: 200, body: rss_feed, headers: {})
18
      stub_request(:get, "https://pdc-describe-prod.princeton.edu/describe/works/6.json")
2✔
19
        .to_return(status: 200, body: embargo_resource, headers: {})
20
      stub_request(:get, "https://pdc-describe-prod.princeton.edu/describe/works/20.json")
2✔
21
        .to_return(status: 200, body: embargo_resource, headers: {})
22

23
      Blacklight.default_index.connection.delete_by_query("*:*")
2✔
24
      Blacklight.default_index.connection.commit
2✔
25
      indexer.index
2✔
26
    end
27

28
    context "and the PDC Describe Work is under active embargo" do
1✔
29
      let(:document_id) { "doi-10-34770-r75s-9j74-active-embargo" }
2✔
30
      let(:item_file_fixture) { file_fixture("pdc_describe_active_embargo.json") }
2✔
31
      it "renders a message to the client expressing this and detailing the embargo date" do
1✔
32
        visit "/catalog/#{document_id}"
1✔
33
        embargo_message_header = find(:css, '.document-embargo-heading', match: :first).text
1✔
34
        expect(embargo_message_header).to eq("File(s) associated with this object are embargoed until 2033-09-13.")
1✔
35
        embargo_element = find(:css, '#no_files', match: :first).text
1✔
36
        expect(embargo_element).to eq("File(s) associated with this object are embargoed until 2033-09-13.")
1✔
37
      end
38
    end
39

40
    context "and the PDC Describe Work is under an expired embargo" do
1✔
41
      let(:document_id) { "doi-10-34770-r75s-9j74-expired-embargo" }
2✔
42
      let(:item_file_fixture) { file_fixture("pdc_describe_expired_embargo.json") }
2✔
43
      it "does not render the embargo message" do
1✔
44
        visit "/catalog/#{document_id}"
1✔
45
        embargo_message_included = page.html.include?("File(s) associated with this object are embargoed until 2033-09-13T00:00:00Z.")
1✔
46
        expect(embargo_message_included).not_to be true
1✔
47
      end
48
    end
49
  end
50
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc