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

pulibrary / pdc_discovery / 67127f87-d6ab-4898-b96c-5316303871ea

15 Sep 2023 05:16PM UTC coverage: 96.742% (+0.02%) from 96.721%
67127f87-d6ab-4898-b96c-5316303871ea

Pull #506

circleci

jrgriffiniii
Adding indexing support for embargo dates parsed from PDC Describe Works
using the Solr field `embargo_date_dtsi`
Pull Request #506: Adding indexing support for embargo dates parsed from PDC Describe Works

146 of 146 new or added lines in 5 files covered. (100.0%)

2494 of 2578 relevant lines covered (96.74%)

172.59 hits per line

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

96.55
/spec/system/embargoed_document_spec.rb
1
# frozen_string_literal: true
2

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

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

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

27
    context "and the PDC Describe Work is under active embargo" do
1✔
28
      let(:document_id) { "doi-10-34770-r75s-9j74-active-embargo" }
2✔
29
      let(:item_file_fixture) { file_fixture("pdc_describe_active_embargo.json") }
2✔
30
      it "renders a message to the client expressing this and detailing the embargo date" do
1✔
31
        visit "/catalog/#{document_id}"
1✔
32
        embargo_message_included = page.html.include?("File(s) associated with this object are embargoed until 2033-09-13.")
1✔
33
        expect(embargo_message_included).to be true
1✔
34
      end
35
    end
36

37
    context "and the PDC Describe Work is under an expired embargo" do
1✔
38
      let(:document_id) { "doi-10-34770-r75s-9j74-expired-embargo" }
2✔
39
      let(:item_file_fixture) { file_fixture("pdc_describe_expired_embargo.json") }
2✔
40
      it "does not render the embargo message" do
1✔
41
        visit "/catalog/#{document_id}"
1✔
42
        embargo_message_included = page.html.include?("File(s) associated with this object are embargoed until 2033-09-13T00:00:00Z.")
1✔
43
        expect(embargo_message_included).not_to be true
1✔
44
      end
45
    end
46
  end
47
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