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

pulibrary / orangelight / 568e5eaf-17e3-4be7-bffb-a374fe33d340

16 Jul 2025 11:26PM UTC coverage: 95.359% (-0.02%) from 95.377%
568e5eaf-17e3-4be7-bffb-a374fe33d340

Pull #4995

circleci

sandbergja
Refactor build_holding_notes into a View Component
Pull Request #4995: Refactor build_holding_notes into a View Component

33 of 33 new or added lines in 2 files covered. (100.0%)

1 existing line in 1 file now uncovered.

6041 of 6335 relevant lines covered (95.36%)

1514.24 hits per line

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

95.0
/app/services/holding_requests_builder.rb
1
# frozen_string_literal: true
2

3
class HoldingRequestsBuilder
3✔
4
  extend ActionView::Helpers::TagHelper
3✔
5
  extend ActionView::Helpers::UrlHelper
3✔
6

7
  # Generate <div> container for a holding block
8
  # @param children [String] the children for the holding block
9
  # @return [String] the markup
10
  def self.holding_block(children)
3✔
11
    content_tag(:tr, children.html_safe, class: 'holding-block') unless children.empty?
185✔
12
  end
13

14
  # Generate <div> container for holding details
15
  # @param children [String] the children for the holding details
16
  # @return [String] the markup
17
  def self.holding_details(children)
3✔
UNCOV
18
    content_tag(:td, children.html_safe, class: 'holding-details') unless children.empty?
×
19
  end
20

21
  # Generate <div> container for missing item holdings
22
  # @return [String] the markup
23
  def self.missing_holdings
3✔
24
    holding_block(I18n.t('blacklight.holdings.missing'))
3✔
25
  end
26

27
  # Constructor
28
  # @param adapter [HoldingRequestsAdapter] adapter for the SolrDocument and Bibdata API
29
  # @param online_markup_builder [Class] the builder class for online holdings blocks
30
  # @param physical_markup_builder [Class] the builder class for physical holdings blocks
31
  def initialize(adapter:, online_markup_builder:, physical_markup_builder:)
3✔
32
    @adapter = adapter
108✔
33
    @online_markup_builder = online_markup_builder
108✔
34
    @physical_markup_builder = physical_markup_builder
108✔
35
  end
36

37
  # Builds the markup for online and physical holdings for a given record
38
  # @return [Array<String>] the markup for the online and physical holdings
39
  def build
3✔
40
    online_builder = @online_markup_builder.new(@adapter)
108✔
41
    online_markup = online_builder.build
108✔
42

43
    physical_builder = @physical_markup_builder.new(@adapter)
108✔
44
    physical_markup = physical_builder.build
108✔
45

46
    physical_markup = self.class.missing_holdings if physical_markup.blank? && online_markup.blank?
108✔
47

48
    [online_markup, physical_markup]
108✔
49
  end
50
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