Commit 6c191c6cedc3b81d3bb6a012f85e23496d22edd0
1 parent
da607601
Exists in
master
and in
28 other branches
ActionItem6: some untis tests of enterprise model made
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@318 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
17 additions
and
23 deletions
Show diff stats
app/controllers/enterprise_controller.rb
app/views/enterprise/show.rhtml
... | ... | @@ -13,4 +13,4 @@ |
13 | 13 | <%= link_to _('Edit enterprise'), :action => 'edit', :id => @enterprise %> |
14 | 14 | <%= link_to _('Delete enterprise'), :action => 'destroy', :id => @enterprise %> |
15 | 15 | <%= link_to _('Register new enterprise'), :action => 'register_form' %> |
16 | -<%= link_to _('Affiliate'), :action => 'affiliate' %> | |
16 | +<%= link_to _('Affiliate'), :action => 'affiliate' unless @my_enterprises.include?(@enterprise) %> | ... | ... |
test/unit/enterprise_test.rb
... | ... | @@ -45,23 +45,4 @@ class EnterpriseTest < Test::Unit::TestCase |
45 | 45 | p1.identifier = 'bli' |
46 | 46 | end |
47 | 47 | end |
48 | - | |
49 | - def test_numericality_year | |
50 | - count = Enterprise.count | |
51 | - | |
52 | - e = Enterprise.new(:identifier => 'test_numericality_year', :name => 'numeric_year') | |
53 | - e.foundation_year = 'xxxx' | |
54 | - e.valid? | |
55 | - assert e.errors.invalid?(:foundation_year) | |
56 | - | |
57 | - e.foundation_year = 20.07 | |
58 | - e.valid? | |
59 | - assert e.errors.invalid?(:foundation_year) | |
60 | - | |
61 | - e.foundation_year = 2007 | |
62 | - e.valid? | |
63 | - assert ! e.errors.invalid?(:foundation_year) | |
64 | - | |
65 | - end | |
66 | - | |
67 | 48 | end | ... | ... |
test/unit/organization_info_test.rb
... | ... | @@ -3,8 +3,20 @@ require File.dirname(__FILE__) + '/../test_helper' |
3 | 3 | class OrganizationInfoTest < Test::Unit::TestCase |
4 | 4 | fixtures :organization_infos |
5 | 5 | |
6 | - # Replace this with your real tests. | |
7 | - def test_truth | |
8 | - assert true | |
6 | + def test_numericality_year | |
7 | + count = OrganizationInfo.count | |
8 | + | |
9 | + oi = OrganizationInfo.new | |
10 | + oi.foundation_year = 'xxxx' | |
11 | + oi.valid? | |
12 | + assert oi.errors.invalid?(:foundation_year) | |
13 | + | |
14 | + oi.foundation_year = 20.07 | |
15 | + oi.valid? | |
16 | + assert oi.errors.invalid?(:foundation_year) | |
17 | + | |
18 | + oi.foundation_year = 2007 | |
19 | + oi.valid? | |
20 | + assert ! oi.errors.invalid?(:foundation_year) | |
9 | 21 | end |
10 | 22 | end | ... | ... |