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

pulibrary / allsearch_api / ed1cefda-f43b-4b58-95dd-12a33b7f1f7a

02 Jul 2025 06:23PM UTC coverage: 96.252% (-3.2%) from 99.494%
ed1cefda-f43b-4b58-95dd-12a33b7f1f7a

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

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

94 existing lines in 20 files now uncovered.

976 of 1014 relevant lines covered (96.25%)

63.21 hits per line

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

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

3
# This class is responsible for storing and retrieving relevant
4
# metadata from the best_bet_record table in the database
5
class BestBetRecord < ApplicationRecord
2✔
6
  validates :title, :url, :search_terms, presence: true
2✔
7
  scope :query, lambda { |search_term|
2✔
UNCOV
8
                  where('unaccent(?) ILIKE ANY(search_terms) OR unaccent(?) ILIKE title', search_term, search_term)
18✔
9
                }
10
  def self.new_from_csv(row)
2✔
UNCOV
11
    BestBetRecord.create!(
44✔
12
      title: row[0],
13
      description: row[1],
14
      url: row[2],
UNCOV
15
      search_terms: row[3]&.split(', ')&.map { |term| Normalizer.new(term).without_diacritics },
130✔
16
      last_update: last_update(row)
17
    )
18
  rescue ActiveRecord::RecordInvalid => error
UNCOV
19
    Rails.logger.error("Could not create new BestBet for row #{row}: #{error.message}")
3✔
20
  end
21

22
  def self.last_update(row)
2✔
UNCOV
23
    update = row[4]
44✔
UNCOV
24
    return nil if update.blank?
44✔
25

UNCOV
26
    Date.strptime(update, '%B %d, %Y')
43✔
27
  rescue Date::Error
UNCOV
28
    Rails.logger.info("Invalid date for BestBet row: #{row}")
1✔
29
  end
30
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