cirandas.net

ref: master

test/unit/validation_info_test.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require_relative "../test_helper"

class ValidationInfoTest < ActiveSupport::TestCase

  should 'validate the presence of validation methodology description' do
    info = ValidationInfo.new
    info.valid?
    assert info.errors[:validation_methodology].any?
    info.validation_methodology = 'lalala'
    info.valid?
    refute info.errors[:validation_methodology].any?
  end

  should 'refer to and validate the presence of an organization' do
    info = ValidationInfo.new
    assert_raise ActiveRecord::AssociationTypeMismatch do
      info.organization = 1
    end
    assert_nothing_raised do
      info.organization = Organization.new
    end
  end

end