Commit 00a016b4e531f427f2f2adb0ae7d292238e5d69b

Authored by Antonio Terceiro
2 parents 576b7c60 18296911

Merge commit '182969118ee7938f56db5d76725c8b687e33ebb9' into v0.11.x

app/controllers/public/account_controller.rb
... ... @@ -170,6 +170,7 @@ class AccountController < ApplicationController
170 170 end
171 171  
172 172 def activate_enterprise
  173 + @terms_of_use = environment.terms_of_use
173 174 @enterprise = load_enterprise
174 175 @question = @enterprise.question
175 176 return unless check_answer
... ...
app/models/user.rb
... ... @@ -6,6 +6,7 @@ class User < ActiveRecord::Base
6 6  
7 7 N_('Password')
8 8 N_('Password confirmation')
  9 + N_('Terms accepted')
9 10  
10 11 # FIXME ugly workaround
11 12 def self.human_attribute_name(attrib)
... ...
test/functional/account_controller_test.rb
... ... @@ -500,6 +500,19 @@ class AccountControllerTest < Test::Unit::TestCase
500 500 assert_template 'blocked'
501 501 end
502 502  
  503 + should 'load terms of use for users when creating new users as activate enterprise' do
  504 + env = Environment.default
  505 + env.terms_of_use = 'some terms'
  506 + env.save!
  507 + ent = Enterprise.create!(:name => 'test enterprise', :identifier => 'test_ent', :foundation_year => 1998, :enabled => false)
  508 + task = EnterpriseActivation.create!(:enterprise => ent)
  509 + EnterpriseActivation.expects(:find_by_code).with('0123456789').returns(task).at_least_once
  510 +
  511 + post :activate_enterprise, :enterprise_code => '0123456789', :answer => '1998', :terms_accepted => true
  512 +
  513 + assert_equal 'some terms', assigns(:terms_of_use)
  514 + end
  515 +
503 516 # end of enterprise activation tests
504 517  
505 518 should 'not be able to signup while inverse captcha field filled' do
... ...