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

pulibrary / allsearch_api / 842726e7-a026-4fa4-95f6-9644d41e6dd0

02 Jul 2025 06:28PM UTC coverage: 99.507% (+0.01%) from 99.494%
842726e7-a026-4fa4-95f6-9644d41e6dd0

Pull #381

circleci

sandbergja
Refactor RackResponseController so that subclasses don't need to implement #json

Co-authored-by: Christina Chortaria <christinach@users.noreply.github.com>
Pull Request #381: Rewrite DPUL and FindingAids controllers as rack applications

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

81 existing lines in 19 files now uncovered.

1009 of 1014 relevant lines covered (99.51%)

96.77 hits per line

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

100.0
/app/models/library_database_record.rb
1
# frozen_string_literal: true
2

3
LIBRARY_DATABASE_CSV_FIELDS = [:libguides_id, :name, :description, :alt_names_concat, :url,
3✔
4
                               :friendly_url, :subjects_concat].freeze
5

6
class LibraryDatabaseRecord < ApplicationRecord
3✔
7
  scope :query, lambda { |search_term|
3✔
UNCOV
8
                  where(
46✔
9
                    Arel.sql("searchable @@ websearch_to_tsquery('unaccented_dict', unaccent(?))",
10
                             search_term)
11
                  ).order(
12
                    Arel.sql("ts_rank(searchable, websearch_to_tsquery('unaccented_dict', unaccent(?)))",
13
                             search_term).desc
14
                  )
15
                }
16

17
  # :reek:TooManyStatements
18
  def self.new_from_csv(row)
3✔
UNCOV
19
    record = LibraryDatabaseRecord.new
309✔
UNCOV
20
    LIBRARY_DATABASE_CSV_FIELDS.each_with_index { |field, index| record.method(:"#{field}=").call(row[index]) }
2,472✔
UNCOV
21
    record.alt_names = record.alt_names_concat&.split('; ')
309✔
UNCOV
22
    record.subjects = record.subjects_concat&.split(';')
309✔
UNCOV
23
    record.save
309✔
UNCOV
24
    record
309✔
25
  end
26
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