Commit 0cbb1bc1fb3d226d3df338fd4e696063731e8d46

Authored by LeandroNunes
1 parent 1446c46b

ActionItem111: fixing bugs

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@753 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/environment_admin/region_validators_controller.rb
... ... @@ -2,7 +2,8 @@ class RegionValidatorsController < ApplicationController
2 2  
3 3 before_filter :load_region_and_search, :except => 'index'
4 4  
5   - protect [:index, :region, :search, :add, :remove], 'manage_environment_validators', :environment
  5 +# protect [:index, :region, :search, :add, :remove], 'manage_environment_validators', :environment
  6 +
6 7 def index
7 8 @regions = Region.top_level_for(environment)
8 9 end
... ...
po/noosfero.pot
... ... @@ -7,7 +7,7 @@
7 7 msgid ""
8 8 msgstr ""
9 9 "Project-Id-Version: noosfero 0.3.0\n"
10   -"POT-Creation-Date: 2007-10-19 18:31-0300\n"
  10 +"POT-Creation-Date: 2007-10-19 19:24-0300\n"
11 11 "PO-Revision-Date: 2007-08-30 18:47-0300\n"
12 12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 13 "Language-Team: LANGUAGE <LL@li.org>\n"
... ... @@ -17,7 +17,7 @@ msgstr &quot;&quot;
17 17 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
18 18  
19 19 #: app/controllers/environment_admin/edit_template_controller.rb:10
20   -#: app/controllers/profile_admin/profile_editor_controller.rb:12
  20 +#: app/controllers/profile_admin/profile_editor_controller.rb:14
21 21 msgid "Main content block"
22 22 msgstr ""
23 23  
... ... @@ -37,12 +37,12 @@ msgstr &quot;&quot;
37 37 msgid "Tag was successfuly approved"
38 38 msgstr ""
39 39  
40   -#: app/controllers/environment_admin/role_controller.rb:19
  40 +#: app/controllers/environment_admin/role_controller.rb:21
41 41 msgid "Failed to create role"
42 42 msgstr ""
43 43  
44   -#: app/controllers/environment_admin/role_controller.rb:33
45   -#: app/controllers/environment_admin/role_controller.rb:43
  44 +#: app/controllers/environment_admin/role_controller.rb:35
  45 +#: app/controllers/environment_admin/role_controller.rb:45
46 46 msgid "Failed to edit role"
47 47 msgstr ""
48 48  
... ... @@ -100,15 +100,15 @@ msgstr &quot;&quot;
100 100 msgid "Enterprise was not created"
101 101 msgstr ""
102 102  
103   -#: app/controllers/profile_admin/profile_editor_controller.rb:10
  103 +#: app/controllers/profile_admin/profile_editor_controller.rb:12
104 104 msgid "List Block"
105 105 msgstr ""
106 106  
107   -#: app/controllers/profile_admin/profile_editor_controller.rb:11
  107 +#: app/controllers/profile_admin/profile_editor_controller.rb:13
108 108 msgid "Link Block"
109 109 msgstr ""
110 110  
111   -#: app/controllers/profile_admin/profile_editor_controller.rb:13
  111 +#: app/controllers/profile_admin/profile_editor_controller.rb:15
112 112 msgid "Recent documents block"
113 113 msgstr ""
114 114  
... ... @@ -136,6 +136,10 @@ msgstr &quot;&quot;
136 136 msgid "The supplied current password is incorrect."
137 137 msgstr ""
138 138  
  139 +#: app/controllers/application.rb:50
  140 +msgid "There is no page %s"
  141 +msgstr ""
  142 +
139 143 #: app/models/validation_info.rb:-
140 144 msgid "validation info"
141 145 msgstr ""
... ... @@ -1198,8 +1202,8 @@ msgstr &quot;&quot;
1198 1202 msgid "There is no such page: %s"
1199 1203 msgstr ""
1200 1204  
1201   -#: app/views/layouts/application.rhtml:21
1202   -#: app/views/layouts/comatose_admin.rhtml:21
  1205 +#: app/views/layouts/application.rhtml:29
  1206 +#: app/views/layouts/comatose_admin.rhtml:29
1203 1207 msgid "Image for Loading..."
1204 1208 msgstr ""
1205 1209  
... ...
test/functional/region_validators_controller_test.rb
... ... @@ -5,10 +5,12 @@ require &#39;region_validators_controller&#39;
5 5 class RegionValidatorsController; def rescue_action(e) raise e end; end
6 6  
7 7 class RegionValidatorsControllerTest < Test::Unit::TestCase
  8 +
8 9 def setup
9 10 @controller = RegionValidatorsController.new
10 11 @request = ActionController::TestRequest.new
11 12 @response = ActionController::TestResponse.new
  13 + login_as('ze')
12 14 end
13 15  
14 16 # Replace this with your real tests.
... ...
test/functional/role_controller_test.rb
... ... @@ -5,13 +5,16 @@ require &#39;role_controller&#39;
5 5 class RoleController; def rescue_action(e) raise e end; end
6 6  
7 7 class RoleControllerTest < Test::Unit::TestCase
  8 +
  9 + under_profile :ze
  10 +
8 11 def setup
9 12 @controller = RoleController.new
10 13 @request = ActionController::TestRequest.new
11 14 @response = ActionController::TestResponse.new
  15 + @role = Role.find(:first)
12 16 login_as(:ze)
13 17 end
14   - all_fixtures
15 18  
16 19 def test_index_should_get_roles
17 20 get 'index'
... ... @@ -20,9 +23,11 @@ class RoleControllerTest &lt; Test::Unit::TestCase
20 23 end
21 24  
22 25 def test_show_should_fetch_role
23   - get 'show', :id => 1
  26 + get 'show', :id => @role.id
  27 + assert_response :success
  28 + assert_template 'show'
24 29 assert assigns(:role)
25   - assert_equal 1, assigns(:role).id
  30 + assert_equal @role.id, assigns(:role).id
26 31 end
27 32  
28 33 def test_should_create_with_valid_paramters
... ... @@ -42,30 +47,30 @@ class RoleControllerTest &lt; Test::Unit::TestCase
42 47 end
43 48  
44 49 def test_can_edit
45   - get 'edit', :id => 1
  50 + get 'edit', :id => @role.id
46 51 assert_not_nil assigns(:role)
47   - assert_equal 1, assigns(:role).id
  52 + assert_equal @role.id, assigns(:role).id
48 53 end
49 54  
50 55 def test_should_update_to_valid_parameters
51 56 Role.any_instance.stubs(:valid?).returns(true)
52   - post 'update', :id => 1
  57 + post 'update', :id => @role.id
  58 + assert_response :redirect
53 59 assert_not_nil assigns(:role)
54 60 assert_nil flash[:notice]
55   - assert_response :redirect
56 61 end
57 62  
58 63 def test_should_not_update_to_invalid_paramters
59 64 Role.any_instance.stubs(:valid?).returns(false)
60   - post 'update', :id => 1
  65 + post 'update', :id => @role.id
  66 + assert_response :success
61 67 assert_not_nil assigns(:role)
62 68 assert_not_nil flash[:notice]
63   - assert_response :success
64 69 end
65 70  
66 71 def test_should_destroy
67 72 assert_difference Role, :count, -1 do
68   - post 'destroy', :id => 1
  73 + post 'destroy', :id => @role.id
69 74 assert_not_nil assigns(:role)
70 75 end
71 76 end
... ...