From 1c808e31c3bd4f984d6c2ff669f812aa0ad39359 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Tue, 13 Nov 2007 22:41:02 +0000 Subject: [PATCH] ActionItem117: renaming in test --- test/functional/my_profile_controller_test.rb | 38 ++++++++++++++++++++++++++++++++++++++ test/functional/profile_admin_controller_test.rb | 38 -------------------------------------- 2 files changed, 38 insertions(+), 38 deletions(-) create mode 100644 test/functional/my_profile_controller_test.rb delete mode 100644 test/functional/profile_admin_controller_test.rb diff --git a/test/functional/my_profile_controller_test.rb b/test/functional/my_profile_controller_test.rb new file mode 100644 index 0000000..36bc10f --- /dev/null +++ b/test/functional/my_profile_controller_test.rb @@ -0,0 +1,38 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'profile_admin_controller' + +# Re-raise errors caught by the controller. +class ProfileAdminController; def rescue_action(e) raise e end; end + +class OnlyForPersonTestController < ProfileAdminController + requires_profile_class Person + def index + render :text => '
something
' + end +end + +class ProfileAdminControllerTest < Test::Unit::TestCase + + all_fixtures + def setup + @controller = ProfileAdminController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + def test_should_allow_person + @controller = OnlyForPersonTestController.new + person = create_user('random_joe') + + get :index, :profile => 'random_joe' + assert_response :success + end + + def test_should_not_allow_bare_profile + @controller = OnlyForPersonTestController.new + org = Organization.create!(:identifier => 'hacking_institute', :name => 'Hacking Institute') + + get :index, :profile => 'hacking_institute' + assert_response 403 # forbidden + end +end diff --git a/test/functional/profile_admin_controller_test.rb b/test/functional/profile_admin_controller_test.rb deleted file mode 100644 index 36bc10f..0000000 --- a/test/functional/profile_admin_controller_test.rb +++ /dev/null @@ -1,38 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' -require 'profile_admin_controller' - -# Re-raise errors caught by the controller. -class ProfileAdminController; def rescue_action(e) raise e end; end - -class OnlyForPersonTestController < ProfileAdminController - requires_profile_class Person - def index - render :text => '
something
' - end -end - -class ProfileAdminControllerTest < Test::Unit::TestCase - - all_fixtures - def setup - @controller = ProfileAdminController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - end - - def test_should_allow_person - @controller = OnlyForPersonTestController.new - person = create_user('random_joe') - - get :index, :profile => 'random_joe' - assert_response :success - end - - def test_should_not_allow_bare_profile - @controller = OnlyForPersonTestController.new - org = Organization.create!(:identifier => 'hacking_institute', :name => 'Hacking Institute') - - get :index, :profile => 'hacking_institute' - assert_response 403 # forbidden - end -end -- libgit2 0.21.2