diff --git a/test/models/availability_test.rb b/test/models/availability_test.rb index 53d48faf7..e7b35b388 100644 --- a/test/models/availability_test.rb +++ b/test/models/availability_test.rb @@ -6,4 +6,10 @@ class AvailabilityTest < ActiveSupport::TestCase assert a.invalid? assert a.errors.key?(:end_at) end + + test "if type available_type is 'machines' check that there is minimum 1 association" do + a = Availability.new(start_at: Time.now, end_at: 2.hours.from_now, available_type: 'machines') + assert a.invalid? + assert a.errors.key?(:machine_ids) + end end