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

pulibrary / pdc_describe / 246d1c21-d1e3-4992-98a7-13140240fbdc

pending completion
246d1c21-d1e3-4992-98a7-13140240fbdc

Pull #1028

circleci

jrgriffiniii
wip
Pull Request #1028: Implementing the UploadSnapshotsController

71 of 71 new or added lines in 5 files covered. (100.0%)

1911 of 1952 relevant lines covered (97.9%)

172.9 hits per line

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

83.33
/app/models/upload_snapshot.rb
1
# frozen_string_literal: true
2
class UploadSnapshot < ApplicationRecord
1✔
3
  belongs_to :work
1✔
4
  attr_writer :version
1✔
5
  attr_writer :upload
1✔
6
  has_one_attached :binary
1✔
7

8
  before_create do |upload_snapshot|
1✔
9
    persisted = UploadSnapshot.where(key: upload_snapshot.key, url: upload_snapshot.url, work: upload_snapshot.work)
8✔
10
    version = if persisted.empty?
8✔
11
                1
6✔
12
              else
13
                persisted.last.version + 1
2✔
14
              end
15

16
    upload_snapshot.version = version
6✔
17
  end
18

19
  def upload
1✔
20
    @upload ||= uploads.find { |s3_file| key.include?(s3_file.key) }
×
21
  end
22

23
  def uri
1✔
24
    URI.parse(url)
×
25
  end
26

27
  private
1✔
28

29
    def uploads
1✔
30
      work.uploads
×
31
    end
32
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