Commit f5668ee42b673905c7de824bb57c768a6151b495
Committed by
Fabio Teixeira
1 parent
c24d8eb8
Exists in
master
and in
5 other branches
Fix unit test for institution
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
Showing
2 changed files
with
2 additions
and
1 deletions
Show diff stats
lib/institution.rb
| @@ -29,6 +29,7 @@ class Institution < ActiveRecord::Base | @@ -29,6 +29,7 @@ class Institution < ActiveRecord::Base | ||
| 29 | 29 | ||
| 30 | unless valid_institutions_type.include? self.type | 30 | unless valid_institutions_type.include? self.type |
| 31 | self.errors.add(:type, _("invalid, only public and private institutions are allowed.")) | 31 | self.errors.add(:type, _("invalid, only public and private institutions are allowed.")) |
| 32 | + | ||
| 32 | return false | 33 | return false |
| 33 | end | 34 | end |
| 34 | return true | 35 | return true |
test/unit/institution_test.rb
| @@ -19,7 +19,7 @@ class InstitutionTest < ActiveSupport::TestCase | @@ -19,7 +19,7 @@ class InstitutionTest < ActiveSupport::TestCase | ||
| 19 | 19 | ||
| 20 | should "not save if institution has invalid type" do | 20 | should "not save if institution has invalid type" do |
| 21 | @institution.type = "Other type" | 21 | @institution.type = "Other type" |
| 22 | - assert !@institution.save | 22 | + assert !@institution.save, 'Invalid type' |
| 23 | assert @institution.errors.full_messages.include? "Type invalid, only public and private institutions are allowed." | 23 | assert @institution.errors.full_messages.include? "Type invalid, only public and private institutions are allowed." |
| 24 | end | 24 | end |
| 25 | 25 |