Commit 4a8583d3308b6ad4f00999f006fde83fd6a76f30

Authored by Antonio Terceiro
1 parent cc6e4746

ActionItem1125: display only to people

app/views/profile_editor/index.rhtml
@@ -62,7 +62,7 @@ @@ -62,7 +62,7 @@
62 <%= control_panel_button(_('Manage my groups'), 'groups', :controller => 'memberships') if profile.person? %> 62 <%= control_panel_button(_('Manage my groups'), 'groups', :controller => 'memberships') if profile.person? %>
63 <% end %> 63 <% end %>
64 64
65 - <% if environment.enabled?('enterprise_activation') %> 65 + <% if profile.person? && environment.enabled?('enterprise_activation') %>
66 66
67 <div id='activation_enterprise'> 67 <div id='activation_enterprise'>
68 <% form_tag({:controller => 'account', :action => 'activation_question'}, {:method => 'get'}) do %> 68 <% form_tag({:controller => 'account', :action => 'activation_question'}, {:method => 'get'}) do %>
test/functional/profile_editor_controller_test.rb
@@ -712,5 +712,17 @@ class ProfileEditorControllerTest &lt; Test::Unit::TestCase @@ -712,5 +712,17 @@ class ProfileEditorControllerTest &lt; Test::Unit::TestCase
712 assert_tag :tag => 'div', :attributes => { :id => 'activation_enterprise' }, :descendant => {:tag => 'form', :attributes => {:action => '/account/activation_question'}} 712 assert_tag :tag => 'div', :attributes => { :id => 'activation_enterprise' }, :descendant => {:tag => 'form', :attributes => {:action => '/account/activation_question'}}
713 end 713 end
714 714
  715 + should 'not display enterprise activation to enterprises' do
  716 + env = Environment.default
  717 + env.enable('enterprise_activation')
  718 + env.save!
  719 +
  720 + enterprise = Enterprise.create!(:name => 'bli', :identifier => 'bli')
  721 + enterprise.add_admin(profile)
  722 +
  723 + get :index, :profile => enterprise.identifier
  724 + assert_no_tag :tag => 'div', :attributes => { :id => 'activation_enterprise' }, :descendant => {:tag => 'form', :attributes => {:action => '/account/activation_question'}}
  725 + end
  726 +
715 727
716 end 728 end