diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/custom_values.yml | 2 | ||||
-rw-r--r-- | test/functional/projects_controller_test.rb | 12 | ||||
-rw-r--r-- | test/functional/users_controller_test.rb | 15 | ||||
-rw-r--r-- | test/integration/api_test/projects_test.rb | 9 |
4 files changed, 36 insertions, 2 deletions
diff --git a/test/fixtures/custom_values.yml b/test/fixtures/custom_values.yml index 76ce067a7..58288b39f 100644 --- a/test/fixtures/custom_values.yml +++ b/test/fixtures/custom_values.yml @@ -28,7 +28,7 @@ custom_values_003: custom_field_id: 4 customized_id: 2 id: 3 - value: "" + value: "01 42 50 00 00" custom_values_004: customized_type: Issue custom_field_id: 2 diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 7122f89e2..59d6286a1 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -284,6 +284,18 @@ class ProjectsControllerTest < ActionController::TestCase assert_template 'show' assert_not_nil assigns(:project) assert_equal Project.find_by_identifier('ecookbook'), assigns(:project) + + assert_tag 'li', :content => /Development status/ + end + + def test_show_should_not_display_hidden_custom_fields + ProjectCustomField.find_by_name('Development status').update_attribute :visible, false + get :show, :id => 'ecookbook' + assert_response :success + assert_template 'show' + assert_not_nil assigns(:project) + + assert_no_tag 'li', :content => /Development status/ end def test_show_should_not_fail_when_custom_values_are_nil diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index 5e288d445..100ec8ded 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -24,7 +24,7 @@ class UsersController; def rescue_action(e) raise e end; end class UsersControllerTest < ActionController::TestCase include Redmine::I18n - fixtures :users, :projects, :members, :member_roles, :roles, :auth_sources + fixtures :users, :projects, :members, :member_roles, :roles, :auth_sources, :custom_fields, :custom_values def setup @controller = UsersController.new @@ -65,6 +65,19 @@ class UsersControllerTest < ActionController::TestCase assert_response :success assert_template 'show' assert_not_nil assigns(:user) + + assert_tag 'li', :content => /Phone number/ + end + + def test_show_should_not_display_hidden_custom_fields + @request.session[:user_id] = nil + UserCustomField.find_by_name('Phone number').update_attribute :visible, false + get :show, :id => 2 + assert_response :success + assert_template 'show' + assert_not_nil assigns(:user) + + assert_no_tag 'li', :content => /Phone number/ end def test_show_should_not_fail_when_custom_values_are_nil diff --git a/test/integration/api_test/projects_test.rb b/test/integration/api_test/projects_test.rb index 7c090a925..de84daa08 100644 --- a/test/integration/api_test/projects_test.rb +++ b/test/integration/api_test/projects_test.rb @@ -36,6 +36,15 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest get '/projects/1.xml' assert_response :success assert_equal 'application/xml', @response.content_type + assert_tag 'custom_field', :attributes => {:name => 'Development status'}, :content => 'Stable' + end + + def test_show_should_not_display_hidden_custom_fields + ProjectCustomField.find_by_name('Development status').update_attribute :visible, false + get '/projects/1.xml' + assert_response :success + assert_equal 'application/xml', @response.content_type + assert_no_tag 'custom_field', :attributes => {:name => 'Development status'} end def test_create |