public_institution_test.rb
1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require File.dirname(__FILE__) + '/../../../../test/test_helper'
class PublicInstitutionTest < ActiveSupport::TestCase
def setup
govPower = GovernmentalPower.create(:name=>"Some Gov Power")
govSphere = GovernmentalSphere.create(:name=>"Some Gov Sphere")
@institution = PublicInstitution::new :name=>"Simple Public Institution", :acronym=>"SPI",
:governmental_power=>govPower, :governmental_sphere=>govSphere
end
should "save without a cnpj" do
@institution.cnpj = nil
assert @institution.save
end
should "Not save institution without an acronym" do
@institution.acronym = nil
assert !@institution.save
assert @institution.errors.full_messages.include? "Acronym can't be blank"
end
should "Not save institution without a governmental_power" do
@institution.governmental_power = nil
assert !@institution.save
assert @institution.errors.full_messages.include? "Governmental power can't be blank"
end
should "Not save institution without a governmental_sphere" do
@institution.governmental_sphere = nil
assert !@institution.save
assert @institution.errors.full_messages.include? "Governmental sphere can't be blank"
end
end