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

pulibrary / allsearch_api / 86b37b3b-0695-4222-b987-18af25add842

02 Dec 2025 05:05PM UTC coverage: 87.896% (-12.0%) from 99.903%
86b37b3b-0695-4222-b987-18af25add842

push

circleci

web-flow
Merge pull request #415 from pulibrary/remove-library-database-record

Remove ActiveRecord-based LibraryDatabaseRecord class

5 of 14 new or added lines in 2 files covered. (35.71%)

54 existing lines in 12 files now uncovered.

915 of 1041 relevant lines covered (87.9%)

42.44 hits per line

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

56.25
/app/models/library_database_document.rb
1
# frozen_string_literal: true
2

3
# This class is responsible for getting relevant
4
# metadata from the LibraryDatabaseRelation in the database
5
class LibraryDatabaseDocument
1✔
6
  def initialize(attributes)
1✔
UNCOV
7
    @attributes = attributes
×
8
  end
9

10
  # Returns a hash that can be included in the JSON response
11
  # rubocop:disable Metrics/MethodLength
12
  def public_metadata
1✔
13
    {
UNCOV
14
      title: attributes[:name],
×
15
      id: attributes[:libguides_id]&.to_s,
16
      type: 'Database',
17
      description: sanitize(attributes[:description]),
18
      url: attributes[:friendly_url],
19
      other_fields: {
20
        subjects: subjects,
21
        alternative_titles: alternative_titles
22
      }
23
    }.compact
24
  end
25
  # rubocop:enable Metrics/MethodLength
26

27
  private
1✔
28

29
  attr_reader :attributes
1✔
30

31
  def subjects
1✔
UNCOV
32
    attributes[:subjects]&.join(', ')
×
33
  end
34

35
  def alternative_titles
1✔
UNCOV
36
    attributes[:alt_names]&.join(', ')
×
37
  end
38

39
  def sanitizer
1✔
UNCOV
40
    @sanitizer ||= Sanitizer.new
×
41
  end
42

43
  def sanitize(text)
1✔
UNCOV
44
    return text if text.blank?
×
45

UNCOV
46
    sanitizer.sanitize(text, scrubber: TextScrubber.new)
×
47
  end
48
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

© 2026 Coveralls, Inc