private_institution_test.rb
1.35 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
39
40
41
42
43
44
45
46
47
48
49
50
require File.dirname(__FILE__) + '/../../../../test/test_helper'
require File.dirname(__FILE__) + '/../helpers/plugin_test_helper'
class PrivateInstitutionTest < ActiveSupport::TestCase
include PluginTestHelper
def setup
@institution = create_private_institution(
"Simple Private Institution",
"SPI",
"BR",
"DF",
"Gama",
"00.000.000/0001-00"
)
end
def teardown
@institution = nil
Institution.destroy_all
end
should "not save without a cnpj" do
@institution.cnpj = nil
assert !@institution.save
assert @institution.errors.full_messages.include? "Cnpj can't be blank"
end
should "not save with a repeated cnpj" do
msg = "Cnpj has already been taken"
assert @institution.save
sec_institution = create_private_institution(
"Another Private Institution",
"API",
"BR",
"DF",
"Gama",
"00.000.000/0001-00"
)
assert sec_institution.errors.full_messages.include? msg
end
should "save without fantasy name" do
@institution.acronym = nil
@institution.community.save
assert @institution.save
end
end