• 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

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

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

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

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

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
    author_top_of_page = '<span class="author-name">'
1✔
35
    author_popover_title = 'data-original-title="Trueman, Daniel"'
1✔
36
    author_popover_orcid = 'https://orcid.org/1234-1234-1234-1234'
1✔
37
    author_popover_affiliation = "<a href='/?f[authors_affiliation_ssim][]=Princeton+Plasma+Physics+Laboratory&amp;q=&amp;search_field=all_fields'>Princeton Plasma Physics Laboratory</a><br/>"
1✔
38
    author_popover_search_orcid = '/?&amp;q=1234-1234-1234-1234&amp;search_field=ORCID'
1✔
39
    author_meta = 'Trueman, Daniel (Princeton Plasma Physics Laboratory)'
1✔
40
    expect(page.html.include?(author_top_of_page)).to be true
1✔
41
    expect(page.html.include?(author_popover_title)).to be true
1✔
42
    expect(page.html.include?(author_popover_orcid)).to be true
1✔
43
    expect(page.html.include?(author_popover_search_orcid)).to be true
1✔
44
    expect(page.html.include?(author_popover_affiliation)).to be true
1✔
45
    expect(page.html.include?(author_meta)).to be true
1✔
46
  end
47

48
  it "renders collection tags as links" do
1✔
49
    visit '/catalog/doi-10-34770-r75s-9j74'
1✔
50
    tag1 = "<a href=\"/?f[collection_tag_ssim][]=Humanities"
1✔
51
    tag2 = "<a href=\"/?f[collection_tag_ssim][]=Something+else"
1✔
52
    expect(page.html.include?(tag1)).to be true
1✔
53
    expect(page.html.include?(tag2)).to be true
1✔
54
  end
55

56
  # rubocop:disable Layout/LineLength
57
  xit "has expected citation information" do
1✔
58
    visit '/catalog/78348'
×
59
    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."
×
60
    expect(page).to have_content apa_citation
×
61
    expect(page.html.include?('<button id="show-apa-citation-button"')).to be true
×
62
    expect(page.html.include?('<button id="show-bibtex-citation-button"')).to be true
×
63
  end
64
  # rubocop:enable Layout/LineLength
65

66
  xit "has expected HTML SPAN element with COinS information" do
1✔
67
    visit '/catalog/78348'
×
68
    expect(page.html.include?('<span class="Z3988"')).to be true
×
69
  end
70

71
  xit "renders pageviews and downloads stats" do
1✔
72
    visit '/catalog/78348'
×
73
    expect(page.html.include?('<span id="pageviews"')).to be true
×
74
    expect(page.html.include?('<span id="downloads"')).to be true
×
75
  end
76

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

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