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

pulibrary / pdc_discovery / 529bb1cf-d0bf-4901-97c6-12679aea8117

17 Aug 2023 01:30PM UTC coverage: 90.265% (-6.3%) from 96.544%
529bb1cf-d0bf-4901-97c6-12679aea8117

Pull #478

circleci

carolyncole
Updates to css to fix tests after bundle update
Also ran rubocop -A && Prettier
Pull Request #478: Switching to selenium to fix CI

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

2142 of 2373 relevant lines covered (90.27%)

93.35 hits per line

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

41.18
/spec/requests/pppl_spec.rb
1
# frozen_string_literal: true
2
require 'rails_helper'
1✔
3

4
RSpec.describe "PPPL has a harvest endpoint", type: :request do
1✔
5
  let(:pppl1) { File.read(File.join(fixture_path, 'files', 'pppl1.json')) }
3✔
6
  let(:pppl2) { File.read(File.join(fixture_path, 'files', 'pppl2.json')) }
1✔
7
  let(:pppl3) { File.read(File.join(fixture_path, 'files', 'pppl3.json')) }
1✔
8
  let(:pppl4) { File.read(File.join(fixture_path, 'files', 'pppl4.json')) }
1✔
9

10
  let(:other_data) { File.read(File.join(fixture_path, 'files', 'bitklavier_binaural.json')) }
1✔
11
  let(:indexer) { DescribeIndexer.new }
3✔
12

13
  before do
1✔
14
    Blacklight.default_index.connection.delete_by_query('*:*')
2✔
15
    Blacklight.default_index.connection.commit
2✔
16
    indexer.index_one(pppl1)
2✔
17
    indexer.index_one(pppl2)
×
18
    indexer.index_one(other_data)
×
19
    indexer.index_one(pppl3)
×
20

21
    # Note that pppl4 should have the most recent timestamp, since it was indexed last
22
    indexer.index_one(pppl4)
×
23
  end
24

25
  # We provide the entire PDC Describe JSON record in the solr field pdc_describe_json_ss
26
  it "provides PDC Describe JSON records for OSTI reporting" do
1✔
27
    get "/pppl_reporting_feed.json"
×
28
    expect(response).to have_http_status(:success)
×
29
    results = JSON.parse(response.body)
×
30
    # There should be 5 records in the index, but only 4 of them are from PPPL
31
    expect(results.count).to eq 4
×
32
    # The most recently indexed item (pppl4) should be first
33
    first_doi_url = JSON.parse(results.first["pdc_describe_json_ss"])["resource"]["doi"]
×
34
    expect(first_doi_url).to match(JSON.parse(pppl4)["resource"]["doi"])
×
35
  end
36

37
  it "can paginate through multiple pages of responses" do
1✔
38
    get "/pppl_reporting_feed.json?per_page=2"
×
39
    results = JSON.parse(response.body)
×
40

41
    # The first item on the first page is pppl4 because it was indexed most recently
42
    doi1 = JSON.parse(results.first["pdc_describe_json_ss"])["resource"]["doi"]
×
43
    expect(doi1).to match(JSON.parse(pppl4)["resource"]["doi"])
×
44

45
    # Because we set the per_page parameter to 2, we should see two results on the first page
46
    expect(results.count).to eq 2
×
47

48
    get "/pppl_reporting_feed.json?per_page=2&page=2"
×
49
    results = JSON.parse(response.body)
×
50
    expect(results.count).to eq 2
×
51

52
    # The first item on the second page should be pppl2
53
    doi2 = JSON.parse(results.first["pdc_describe_json_ss"])["resource"]["doi"]
×
54
    expect(doi2).to match(JSON.parse(pppl2)["resource"]["doi"])
×
55
  end
56
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