• 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

97.62
/spec/lib/metadata_mapping_spec.rb
1
# frozen_string_literal: true
2

3
RSpec.describe DspaceIndexer do
1✔
4
  describe 'indexing a single record' do
1✔
5
    let(:single_item) { file_fixture("single_item.xml").read }
34✔
6
    let(:indexer) do
1✔
7
      described_class.new(single_item)
33✔
8
    end
9
    let(:indexed_record) do
1✔
10
      Blacklight.default_index.connection.delete_by_query("*:*")
33✔
11
      Blacklight.default_index.connection.commit
33✔
12
      indexer.index
33✔
13
      response = Blacklight.default_index.connection.get 'select', params: { q: '*:*' }
×
14
      response["response"]["docs"].first
×
15
    end
16

17
    context "fields for above the fold single page display" do
1✔
18
      it "abstract" do
1✔
19
        expect(indexed_record["abstract_tsim"].first).to match(/discharge parameters/)
1✔
20
      end
21

22
      it "author" do
1✔
23
        authors = ['Stotler, D.', 'F. Scotti', 'R.E. Bell', 'A. Diallo', 'B.P. LeBlanc', 'M. Podesta', 'A.L. Roquemore', 'P.W. Ross']
1✔
24
        expect(indexed_record["author_tesim"]).to eq authors
1✔
25
      end
26

27
      it "contributor" do
1✔
28
        expect(indexed_record["contributor_tsim"]).to contain_exactly "Stotler, Daren"
1✔
29
      end
30

31
      it "description" do
1✔
32
        expect(indexed_record["description_tsim"].first).to match(/This dataset is too large to download directly from this item page./)
1✔
33
      end
34

35
      it "issue_date" do
1✔
36
        expect(indexed_record["issue_date_ssim"]).to contain_exactly "August 2015"
1✔
37
      end
38

39
      it "title" do
1✔
40
        expect(indexed_record["title_tesim"]).to contain_exactly "Midplane neutral density profiles in the National Spherical Torus Experiment"
1✔
41
      end
42

43
      it "uri" do
1✔
44
        expect(indexed_record["uri_ssim"]).to contain_exactly "http://arks.princeton.edu/ark:/88435/dsp01zg64tp300"
1✔
45
      end
46
    end
47

48
    context "contributor" do
1✔
49
      it "advisor" do
1✔
50
        expect(indexed_record["advisor_tesim"]).to contain_exactly "Fake Advisor"
1✔
51
      end
52

53
      it "editor" do
1✔
54
        expect(indexed_record["editor_tesim"]).to contain_exactly "Fake Editor"
1✔
55
      end
56

57
      it "illustrator" do
1✔
58
        expect(indexed_record["illustrator_tesim"]).to contain_exactly "Fake Illustrator"
1✔
59
      end
60

61
      it "other contributor" do
1✔
62
        expect(indexed_record["other_contributor_tsim"]).to contain_exactly "Fake Other"
1✔
63
      end
64

65
      it "creator" do
1✔
66
        expect(indexed_record["creator_tesim"]).to contain_exactly "Fake Creator"
1✔
67
      end
68
    end
69

70
    context "coverage" do
1✔
71
      it "spatial" do
1✔
72
        expect(indexed_record["spatial_coverage_tesim"]).to contain_exactly "Narnia"
1✔
73
      end
74
      it "temporal" do
1✔
75
        expect(indexed_record["temporal_coverage_tesim"]).to contain_exactly "A long time ago"
1✔
76
      end
77
    end
78

79
    context "dates" do
1✔
80
      it "copyright date" do
1✔
81
        expect(indexed_record["copyright_date_ssim"]).to contain_exactly "2 May 1976"
1✔
82
      end
83
      it "date" do
1✔
84
        expect(indexed_record["date_ssim"]).to contain_exactly "19 September 2015"
1✔
85
      end
86
      it "date accessioned" do
1✔
87
        expect(indexed_record["date_accessioned_ssim"]).to contain_exactly "18 August 2015"
1✔
88
      end
89
      it "date available" do
1✔
90
        expect(indexed_record["date_available_ssim"]).to contain_exactly "11 November 2016"
1✔
91
      end
92
      it "date created" do
1✔
93
        expect(indexed_record["date_created_ssim"]).to contain_exactly "1 May 1976"
1✔
94
      end
95
      it "date submitted" do
1✔
96
        expect(indexed_record["date_submitted_ssim"]).to contain_exactly "6 August 2015"
1✔
97
      end
98
    end
99

100
    context "dc.description" do
1✔
101
      it "provenance" do
1✔
102
        expect(indexed_record["provenance_ssim"]).to contain_exactly "Fake Provenance"
1✔
103
      end
104
      it "sponsorship" do
1✔
105
        expect(indexed_record["sponsorship_ssim"]).to contain_exactly "Fake Sponsorship"
1✔
106
      end
107
      it "statementofresponsibility" do
1✔
108
        expect(indexed_record["statementofresponsibility_ssim"]).to contain_exactly "Fake Statement of Responsibility"
1✔
109
      end
110
      it "tableofcontents" do
1✔
111
        expect(indexed_record["tableofcontents_tesim"]).to contain_exactly "readme.txt (table of contents), Stotler_PoP.zip"
1✔
112
      end
113
      it "description uri" do
1✔
114
        expect(indexed_record["description_uri_ssim"]).to contain_exactly "http://fake.description.uri"
1✔
115
      end
116
    end
117

118
    context "identifiers" do
1✔
119
      it "dc.identifier" do
1✔
120
        expect(indexed_record["other_identifier_ssim"]).to contain_exactly "mst3k"
1✔
121
      end
122
      it "dc.identifier.citation" do
1✔
123
        expect(indexed_record["citation_ssim"]).to contain_exactly "This is a fake citation."
1✔
124
      end
125
      it "dc.identifier.govdoc" do
1✔
126
        expect(indexed_record["govdoc_id_ssim"]).to contain_exactly "fake.govdoc.id"
1✔
127
      end
128
      it "dc.identifier.isbn" do
1✔
129
        expect(indexed_record["isbn_ssim"]).to contain_exactly "0-13-117705-2"
1✔
130
      end
131
      it "dc.identifier.issn" do
1✔
132
        expect(indexed_record["issn_ssim"]).to contain_exactly "0-123-456789"
1✔
133
      end
134
      it "dc.identifier.sici" do
1✔
135
        expect(indexed_record["sici_ssim"]).to contain_exactly "987654321"
1✔
136
      end
137
      it "dc.identifier.ismn" do
1✔
138
        expect(indexed_record["ismn_ssim"]).to contain_exactly "0000-1111-0000"
1✔
139
      end
140
      it "dc.identifier.other" do
1✔
141
        expect(indexed_record["local_id_ssim"]).to contain_exactly "12345-67890"
1✔
142
      end
143
    end
144
  end
145
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