Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/models/hold.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class Hold < ApplicationRecord
validates :date_requested, presence: true
validates :date_start, presence: true
validates :date_end, presence: true
validates :hold_source, presence: true
validates :status, presence: true
validates :thesis, presence: true

after_save :update_thesis_status

Expand Down
18 changes: 18 additions & 0 deletions test/models/hold_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ class HoldTest < ActiveSupport::TestCase
assert(hold.invalid?)
end

test 'invalid without thesis' do
hold = holds(:valid)
assert hold.thesis.present?
assert hold.valid?

hold.thesis = nil
assert_not hold.valid?
end

test 'invalid without hold source' do
hold = holds(:valid)
assert hold.hold_source.present?
assert hold.valid?

hold.hold_source = nil
assert_not hold.valid?
end

test 'valid date_start' do
hold = holds(:valid)
assert(hold.valid?)
Expand Down