Commit 1c808e31c3bd4f984d6c2ff669f812aa0ad39359

Authored by AntonioTerceiro
1 parent d4a4e68c

ActionItem117: renaming in test

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@912 3f533792-8f58-4932-b0fe-aaf55b0a4547
test/functional/my_profile_controller_test.rb 0 → 100644
... ... @@ -0,0 +1,38 @@
  1 +require File.dirname(__FILE__) + '/../test_helper'
  2 +require 'profile_admin_controller'
  3 +
  4 +# Re-raise errors caught by the controller.
  5 +class ProfileAdminController; def rescue_action(e) raise e end; end
  6 +
  7 +class OnlyForPersonTestController < ProfileAdminController
  8 + requires_profile_class Person
  9 + def index
  10 + render :text => '<div>something</div>'
  11 + end
  12 +end
  13 +
  14 +class ProfileAdminControllerTest < Test::Unit::TestCase
  15 +
  16 + all_fixtures
  17 + def setup
  18 + @controller = ProfileAdminController.new
  19 + @request = ActionController::TestRequest.new
  20 + @response = ActionController::TestResponse.new
  21 + end
  22 +
  23 + def test_should_allow_person
  24 + @controller = OnlyForPersonTestController.new
  25 + person = create_user('random_joe')
  26 +
  27 + get :index, :profile => 'random_joe'
  28 + assert_response :success
  29 + end
  30 +
  31 + def test_should_not_allow_bare_profile
  32 + @controller = OnlyForPersonTestController.new
  33 + org = Organization.create!(:identifier => 'hacking_institute', :name => 'Hacking Institute')
  34 +
  35 + get :index, :profile => 'hacking_institute'
  36 + assert_response 403 # forbidden
  37 + end
  38 +end
... ...
test/functional/profile_admin_controller_test.rb
... ... @@ -1,38 +0,0 @@
1   -require File.dirname(__FILE__) + '/../test_helper'
2   -require 'profile_admin_controller'
3   -
4   -# Re-raise errors caught by the controller.
5   -class ProfileAdminController; def rescue_action(e) raise e end; end
6   -
7   -class OnlyForPersonTestController < ProfileAdminController
8   - requires_profile_class Person
9   - def index
10   - render :text => '<div>something</div>'
11   - end
12   -end
13   -
14   -class ProfileAdminControllerTest < Test::Unit::TestCase
15   -
16   - all_fixtures
17   - def setup
18   - @controller = ProfileAdminController.new
19   - @request = ActionController::TestRequest.new
20   - @response = ActionController::TestResponse.new
21   - end
22   -
23   - def test_should_allow_person
24   - @controller = OnlyForPersonTestController.new
25   - person = create_user('random_joe')
26   -
27   - get :index, :profile => 'random_joe'
28   - assert_response :success
29   - end
30   -
31   - def test_should_not_allow_bare_profile
32   - @controller = OnlyForPersonTestController.new
33   - org = Organization.create!(:identifier => 'hacking_institute', :name => 'Hacking Institute')
34   -
35   - get :index, :profile => 'hacking_institute'
36   - assert_response 403 # forbidden
37   - end
38   -end