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

pulibrary / orcid_princeton_hanami / d28ce42c-6921-45d8-8241-16192332d785

21 Nov 2025 06:51PM UTC coverage: 99.474% (-0.5%) from 100.0%
d28ce42c-6921-45d8-8241-16192332d785

Pull #146

circleci

carolyncole
Upgrading hanami to 2.3.0

 Co-authored-by: Kate Lynch <kelynch@users.noreply.github.com>
Pull Request #146: Upgrading hanami to 2.3.0

567 of 570 relevant lines covered (99.47%)

7.85 hits per line

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

92.59
/app/view.rb
1
# auto_register: false
2
# frozen_string_literal: true
3

4
require 'hanami/view'
1✔
5

6
require 'tilt/jbuilder'
1✔
7

8
Tilt.register Tilt[:jbuilder], :json
1✔
9

10
module OrcidPrinceton
1✔
11
  # Base Hanami view for the ORCID application
12
  class View < Hanami::View
1✔
13
    include Deps['operations.orcid_api_status']
1✔
14

15
    expose :current_user, layout: true
1✔
16
    expose :code_version, layout: true
1✔
17

18
    expose :code_version_name, layout: true do |code_version|
1✔
19
      if code_version[:tagged_release]
29✔
20
        "<a href=\"https://github.com/pulibrary/orcid_princeton_hanami/releases/tag/#{code_version[:branch]}\" " \
×
21
          "target=\"_blank\">#{code_version[:branch]}</a>"
22
      else
23
        code_version[:branch]
29✔
24
      end
25
    end
26

27
    expose :stale_version, layout: true do |code_version|
1✔
28
      if code_version[:stale]
29✔
29
        '(stale)'
29✔
30
      else
31
        ''
×
32
      end
33
    end
34

35
    expose :orcid_available do
1✔
36
      result = orcid_api_status.call
29✔
37
      result.instance_of?(Dry::Monads::Result::Success)
29✔
38
    end
39

40
    expose :banner_title, layout: true do
1✔
41
      Hanami.app.settings.banner_title
29✔
42
    end
43
    expose :banner_body, layout: true do
1✔
44
      Hanami.app.settings.banner_body
29✔
45
    end
46

47
    # Disables layout when rendering with `format: :json` option
48
    def call(format: :html, **options)
1✔
49
      if format == :json
29✔
50
        super(**options, format:, layout: nil)
1✔
51
      else
52
        super
28✔
53
      end
54
    end
55
  end
56
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