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

pulibrary / orcid_princeton_hanami / 0101d027-cdbd-4181-b895-85a722cff0e8

15 Jul 2025 06:55PM UTC coverage: 98.098% (-1.9%) from 100.0%
0101d027-cdbd-4181-b895-85a722cff0e8

push

circleci

web-flow
Added a method to make a user an administrator (#21)

refs https://github.com/pulibrary/orcid_princeton/issues/530

Co-authored-by: Jane Sandberg <sandbergja@users.noreply.github.com>

9 of 10 new or added lines in 2 files covered. (90.0%)

361 of 368 relevant lines covered (98.1%)

4.53 hits per line

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

61.11
/app/repos/role_repo.rb
1
# frozen_string_literal: true
2

3
module OrcidPrinceton
1✔
4
  module Repos
1✔
5
    # class for setting timestamps on roles
6
    class RoleRepo < OrcidPrinceton::DB::Repo
1✔
7
      def get(id)
1✔
8
        roles.by_pk(id).one!
×
9
      end
10

11
      def admin_role
1✔
12
        role = roles.where(name: 'admin')&.first
3✔
13
        if role.blank?
3✔
NEW
14
          role = create(name: 'admin')
×
15
        end
16
        role
3✔
17
      end
18

19
      def create(attributes)
1✔
20
        attributes[:created_at] = Time.now
×
21
        attributes[:updated_at] = Time.now
×
22
        roles.changeset(:create, attributes).commit
×
23
      end
24

25
      def update(attributes)
1✔
26
        attributes[:updated_at] = Time.now
×
27
        roles.changeset(:create, attributes).commit
×
28
      end
29

30
      def last = roles.last
1✔
31
    end
32
  end
33
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