diff --git a/app/controllers/enterprise_controller.rb b/app/controllers/enterprise_controller.rb index 6900150..f28c303 100644 --- a/app/controllers/enterprise_controller.rb +++ b/app/controllers/enterprise_controller.rb @@ -40,6 +40,7 @@ class EnterpriseController < ApplicationController def edit @enterprise = @my_enterprises.find(params[:id]) + @validation_entities = Organization.find(:all) - [@enterprise] end def update diff --git a/app/views/enterprise/show.rhtml b/app/views/enterprise/show.rhtml index 9fa7531..fa20d01 100644 --- a/app/views/enterprise/show.rhtml +++ b/app/views/enterprise/show.rhtml @@ -13,4 +13,4 @@ <%= link_to _('Edit enterprise'), :action => 'edit', :id => @enterprise %> <%= link_to _('Delete enterprise'), :action => 'destroy', :id => @enterprise %> <%= link_to _('Register new enterprise'), :action => 'register_form' %> -<%= link_to _('Affiliate'), :action => 'affiliate' %> +<%= link_to _('Affiliate'), :action => 'affiliate' unless @my_enterprises.include?(@enterprise) %> diff --git a/test/unit/enterprise_test.rb b/test/unit/enterprise_test.rb index c4a5651..a9522b0 100644 --- a/test/unit/enterprise_test.rb +++ b/test/unit/enterprise_test.rb @@ -45,23 +45,4 @@ class EnterpriseTest < Test::Unit::TestCase p1.identifier = 'bli' end end - - def test_numericality_year - count = Enterprise.count - - e = Enterprise.new(:identifier => 'test_numericality_year', :name => 'numeric_year') - e.foundation_year = 'xxxx' - e.valid? - assert e.errors.invalid?(:foundation_year) - - e.foundation_year = 20.07 - e.valid? - assert e.errors.invalid?(:foundation_year) - - e.foundation_year = 2007 - e.valid? - assert ! e.errors.invalid?(:foundation_year) - - end - end diff --git a/test/unit/organization_info_test.rb b/test/unit/organization_info_test.rb index 92cf899..b4f4734 100644 --- a/test/unit/organization_info_test.rb +++ b/test/unit/organization_info_test.rb @@ -3,8 +3,20 @@ require File.dirname(__FILE__) + '/../test_helper' class OrganizationInfoTest < Test::Unit::TestCase fixtures :organization_infos - # Replace this with your real tests. - def test_truth - assert true + def test_numericality_year + count = OrganizationInfo.count + + oi = OrganizationInfo.new + oi.foundation_year = 'xxxx' + oi.valid? + assert oi.errors.invalid?(:foundation_year) + + oi.foundation_year = 20.07 + oi.valid? + assert oi.errors.invalid?(:foundation_year) + + oi.foundation_year = 2007 + oi.valid? + assert ! oi.errors.invalid?(:foundation_year) end end -- libgit2 0.21.2