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

pulibrary / allsearch_api / 2874ab29-5694-4c81-95af-c4bc480885ab

01 Dec 2025 11:11PM UTC coverage: 99.903%. Remained the same
2874ab29-5694-4c81-95af-c4bc480885ab

push

circleci

sandbergja
Remove ActiveRecord LibraryDatabaseRecord from a test file

Helps with #402

1035 of 1036 relevant lines covered (99.9%)

108.64 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
3✔
6
  validates :title, :url, :search_terms, presence: true
3✔
7
  scope :query, lambda { |search_term|
3✔
8
                  where('unaccent(?) ILIKE ANY(search_terms) OR unaccent(?) ILIKE title', search_term, search_term)
23✔
9
                }
10
  def self.new_from_csv(row)
3✔
11
    BestBetRecord.create!(
107✔
12
      title: row[0],
13
      description: row[1],
14
      url: row[2],
15
      search_terms: row[3]&.split(', ')&.map { |term| Normalizer.new(term).without_diacritics },
327✔
16
      last_update: last_update(row)
17
    )
18
  rescue ActiveRecord::RecordInvalid => error
19
    Rails.logger.error("Could not create new BestBet for row #{row}: #{error.message}")
4✔
20
  end
21

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

26
    Date.strptime(update, '%B %d, %Y')
105✔
27
  rescue Date::Error
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