diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb index c035abb..92aff3c 100644 --- a/app/controllers/public/account_controller.rb +++ b/app/controllers/public/account_controller.rb @@ -170,6 +170,7 @@ class AccountController < ApplicationController end def activate_enterprise + @terms_of_use = environment.terms_of_use @enterprise = load_enterprise @question = @enterprise.question return unless check_answer diff --git a/app/models/user.rb b/app/models/user.rb index 848add7..88070b3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -6,6 +6,7 @@ class User < ActiveRecord::Base N_('Password') N_('Password confirmation') + N_('Terms accepted') # FIXME ugly workaround def self.human_attribute_name(attrib) diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index 63038c2..ab1c22a 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -500,6 +500,19 @@ class AccountControllerTest < Test::Unit::TestCase assert_template 'blocked' end + should 'load terms of use for users when creating new users as activate enterprise' do + env = Environment.default + env.terms_of_use = 'some terms' + env.save! + ent = Enterprise.create!(:name => 'test enterprise', :identifier => 'test_ent', :foundation_year => 1998, :enabled => false) + task = EnterpriseActivation.create!(:enterprise => ent) + EnterpriseActivation.expects(:find_by_code).with('0123456789').returns(task).at_least_once + + post :activate_enterprise, :enterprise_code => '0123456789', :answer => '1998', :terms_accepted => true + + assert_equal 'some terms', assigns(:terms_of_use) + end + # end of enterprise activation tests should 'not be able to signup while inverse captcha field filled' do -- libgit2 0.21.2