Commit 00a016b4e531f427f2f2adb0ae7d292238e5d69b
Exists in
master
and in
22 other branches
Merge commit '182969118ee7938f56db5d76725c8b687e33ebb9' into v0.11.x
Showing
3 changed files
with
15 additions
and
0 deletions
Show diff stats
app/controllers/public/account_controller.rb
| @@ -170,6 +170,7 @@ class AccountController < ApplicationController | @@ -170,6 +170,7 @@ class AccountController < ApplicationController | ||
| 170 | end | 170 | end |
| 171 | 171 | ||
| 172 | def activate_enterprise | 172 | def activate_enterprise |
| 173 | + @terms_of_use = environment.terms_of_use | ||
| 173 | @enterprise = load_enterprise | 174 | @enterprise = load_enterprise |
| 174 | @question = @enterprise.question | 175 | @question = @enterprise.question |
| 175 | return unless check_answer | 176 | return unless check_answer |
app/models/user.rb
| @@ -6,6 +6,7 @@ class User < ActiveRecord::Base | @@ -6,6 +6,7 @@ class User < ActiveRecord::Base | ||
| 6 | 6 | ||
| 7 | N_('Password') | 7 | N_('Password') |
| 8 | N_('Password confirmation') | 8 | N_('Password confirmation') |
| 9 | + N_('Terms accepted') | ||
| 9 | 10 | ||
| 10 | # FIXME ugly workaround | 11 | # FIXME ugly workaround |
| 11 | def self.human_attribute_name(attrib) | 12 | def self.human_attribute_name(attrib) |
test/functional/account_controller_test.rb
| @@ -500,6 +500,19 @@ class AccountControllerTest < Test::Unit::TestCase | @@ -500,6 +500,19 @@ class AccountControllerTest < Test::Unit::TestCase | ||
| 500 | assert_template 'blocked' | 500 | assert_template 'blocked' |
| 501 | end | 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 | # end of enterprise activation tests | 516 | # end of enterprise activation tests |
| 504 | 517 | ||
| 505 | should 'not be able to signup while inverse captcha field filled' do | 518 | should 'not be able to signup while inverse captcha field filled' do |