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

pulibrary / pdc_discovery / fa8e4699-854f-4a43-adc1-7e92603d9eea

pending completion
fa8e4699-854f-4a43-adc1-7e92603d9eea

Pull #441

circleci

Hector Correa
Rubocop nitpicking
Pull Request #441: Indexing to a new collection

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

2073 of 2216 relevant lines covered (93.55%)

170.04 hits per line

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

84.0
/spec/lib/traject/import_helper_spec.rb
1
# frozen_string_literal: true
2
require "./lib/traject/import_helper.rb"
1✔
3

4
RSpec.describe ImportHelper do
1✔
5
  let(:solr_aliases) { file_fixture("solr_aliases.json").read }
5✔
6
  let(:solr_collection_status) { file_fixture("solr_collection_status.json").read }
5✔
7

8
  before do
1✔
9
    stub_request(:get, "http://fake-solr/solr/admin/collections?action=LISTALIASES")
4✔
10
      .with(
11
         headers: {
12
           'Accept' => '*/*',
13
           'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
14
           'User-Agent' => 'Ruby'
15
         }
16
       )
17
      .to_return(status: 200, body: solr_aliases, headers: { 'content-type' => 'application/json; charset=utf-8' })
18

19
    stub_request(:get, "http://fake-solr/solr/admin/collections?action=COLSTATUS&collection=pdc-discovery-production-1")
4✔
20
      .with(
21
       headers: {
22
         'Accept' => '*/*',
23
         'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
24
         'User-Agent' => 'Ruby'
25
       }
26
     )
27
      .to_return(status: 200, body: solr_collection_status, headers: { 'content-type' => 'application/json; charset=utf-8' })
28
  end
29

30
  describe "#solr_collection_for_uri" do
1✔
31
    it "finds the right collection when the Solr URI is an alias" do
1✔
32
      alias_url = URI("http://fake-solr/solr/pdc-discovery-production")
1✔
33
      collection = described_class.solr_collection_for_uri(alias_url)
1✔
34
      expect(collection).to eq "pdc-discovery-production-3"
×
35
    end
36

37
    it "finds the right collection when the Solr URI is a collection" do
1✔
38
      collection_url = URI("http://fake-solr/solr/pdc-discovery-production-3")
1✔
39
      collection = described_class.solr_collection_for_uri(collection_url)
1✔
40
      expect(collection).to eq "pdc-discovery-production-3"
×
41
    end
42

43
    it "defaults to collection in the URL when no alias or collection is found" do
1✔
44
      collection_url = URI("http://fake-solr/solr/collection-in-url")
1✔
45
      collection = described_class.solr_collection_for_uri(collection_url)
1✔
46
      expect(collection).to eq "collection-in-url"
×
47
    end
48
  end
49

50
  describe "#solr_leader_for_uri" do
1✔
51
    it "finds the leader for a given collection" do
1✔
52
      collection_url = URI("http://fake-solr/solr/pdc-discovery-production-1")
1✔
53
      leader_url = described_class.solr_leader_for_uri(collection_url)
1✔
54
      expect(leader_url).to eq "http://lib-solr-prod6.princeton.edu:8983/solr/pdc-discovery-production-1/"
×
55
    end
56
  end
57
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