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