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

pulibrary / pdc_discovery / 5af13607-7741-41ac-b110-c94c8a3ee0f0

pending completion
5af13607-7741-41ac-b110-c94c8a3ee0f0

Pull #441

circleci

hectorcorrea
Better error handling
Pull Request #441: Indexing to a new collection

99 of 99 new or added lines in 3 files covered. (100.0%)

1816 of 2220 relevant lines covered (81.8%)

95.45 hits per line

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

57.69
/spec/system/bitklavier_single_item_metadata_spec.rb
1
# frozen_string_literal: true
2

3
describe 'PDC Describe Bitklavier Single item page', type: :system, js: true do
1✔
4
  let(:rss_feed) { file_fixture("works.rss").read }
4✔
5
  let(:resource1) { file_fixture("sowing_the_seeds.json").read }
4✔
6
  let(:bitklavier_binaural_json) { file_fixture("bitklavier_binaural.json").read }
4✔
7
  let(:rss_url_string) { "https://pdc-describe-prod.princeton.edu/describe/works.rss" }
4✔
8
  let(:indexer) { DescribeIndexer.new(rss_url: rss_url_string) }
4✔
9

10
  before do
1✔
11
    Blacklight.default_index.connection.delete_by_query("*:*")
3✔
12
    Blacklight.default_index.connection.commit
3✔
13
    stub_request(:get, "https://pdc-describe-prod.princeton.edu/describe/works.rss")
3✔
14
      .to_return(status: 200, body: rss_feed, headers: {})
15
    stub_request(:get, "https://pdc-describe-prod.princeton.edu/describe/works/6.json")
3✔
16
      .to_return(status: 200, body: resource1, headers: {})
17
    stub_request(:get, "https://pdc-describe-prod.princeton.edu/describe/works/20.json")
3✔
18
      .to_return(status: 200, body: bitklavier_binaural_json, headers: {})
19
    indexer.index
3✔
20
  end
21

22
  it "has expected header fields" do
1✔
23
    visit '/catalog/doi-10-34770-r75s-9j74'
1✔
24
    expect(page).to have_css '.document-title-heading'
1✔
25
    expect(page).to have_css '.authors-heading'
×
26
    expect(page).to have_css 'div.authors-heading > span > i.bi-person-fill'
×
27
    expect(page).to have_css '.issue-date-heading'
×
28
  end
29

30
  # rubocop:disable RSpec/ExampleLength
31
  it "has expected metadata" do
1✔
32
    visit '/catalog/doi-10-34770-r75s-9j74'
1✔
33
    expect(page).to have_content "bitKlavier Grand Sample Library—Binaural Mic Image"
1✔
34
    authors = "<span>Trueman, Daniel</span>"
×
35
    expected_values = [authors]
×
36
    expected_values.each do |value|
×
37
      expect(page.html.include?(value)).to be true
×
38
    end
39
  end
40
  # rubocop:enable RSpec/ExampleLength
41

42
  it "renders collection tags as links" do
1✔
43
    visit '/catalog/doi-10-34770-r75s-9j74'
1✔
44
    tag1 = "<a href=\"/?f[collection_tag_ssim][]=Humanities"
1✔
45
    tag2 = "<a href=\"/?f[collection_tag_ssim][]=Something+else"
1✔
46
    expect(page.html.include?(tag1)).to be true
1✔
47
    expect(page.html.include?(tag2)).to be true
×
48
  end
49

50
  # rubocop:disable Layout/LineLength
51
  xit "has expected citation information" do
1✔
52
    visit '/catalog/78348'
×
53
    apa_citation = "Stotler, D., F. Scotti, R.E. Bell, A. Diallo, B.P. LeBlanc, M. Podesta, A.L. Roquemore, & P.W. Ross. (2016). Midplane neutral density profiles in the National Spherical Torus Experiment [Data set]. Princeton Plasma Physics Laboratory, Princeton University."
×
54
    expect(page).to have_content apa_citation
×
55
    expect(page.html.include?('<button id="show-apa-citation-button"')).to be true
×
56
    expect(page.html.include?('<button id="show-bibtex-citation-button"')).to be true
×
57
  end
58
  # rubocop:enable Layout/LineLength
59

60
  xit "has expected HTML SPAN element with COinS information" do
1✔
61
    visit '/catalog/78348'
×
62
    expect(page.html.include?('<span class="Z3988"')).to be true
×
63
  end
64

65
  xit "renders pageviews and downloads stats" do
1✔
66
    visit '/catalog/78348'
×
67
    expect(page.html.include?('<span id="pageviews"')).to be true
×
68
    expect(page.html.include?('<span id="downloads"')).to be true
×
69
  end
70

71
  context "clickable links" do
1✔
72
    let(:globus_download_link) { "https://app.globus.org/file-manager?origin_id=dc43f461-0ca7-4203-848c-33a9fc00a464=%2Fvsj7-4j83%2F" }
1✔
73

74
    xit "renders hyperlinks in the abstract and description fields" do
1✔
75
      visit '/catalog/78348'
×
76
      expect(page.html.include?('<a href="http://torus.example.com">http://torus.example.com</a>')).to be true
×
77
      links = page.find("div.document-description").find_all("a").map { |a| a["href"] }
×
78
      expect(links.include?(globus_download_link)).to be true
×
79
    end
80
  end
81
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