Commit 927c6c1b0b71849257f0113534cecbc9aba53483

Authored by LeandroNunes
1 parent 31d7ff73

ActionItem0: fixing bugs

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@144 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/account_controller.rb
1 1 class AccountController < ApplicationController
  2 +
  3 +
  4 +
  5 + uses_flexible_template :owner => 'owner'
  6 +
2 7 # Be sure to include AuthenticationSystem in Application Controller instead
3 8 include AuthenticatedSystem
4 9 # If you want "remember me" functionality, add this before_filter to Application Controller
... ...
app/controllers/edit_template_controller.rb
1 1 class EditTemplateController < ApplicationController
2 2  
3   - uses_flexible_template(:edit => true, :owner => 'owner')
  3 + uses_flexible_template :edit => true, :owner => 'owner'
4 4  
5 5 def flexible_template_owner
6 6 Profile.find(1)
... ...
app/controllers/features_controller.rb
1 1 class FeaturesController < ApplicationController
  2 +
  3 + uses_flexible_template :owner => 'owner'
  4 +
  5 +
2 6 acts_as_virtual_community_admin_controller
3 7  
4 8 def index
... ...
app/controllers/manage_tags_controller.rb
... ... @@ -2,6 +2,10 @@ require &#39;extended_tag.rb&#39;
2 2  
3 3 # Manage tags stored by the acts-as_taggable_on_steroids plugin by providing an interface to create, destroy, update and list them
4 4 class ManageTagsController < ApplicationController
  5 +
  6 + uses_flexible_template :owner => 'owner'
  7 +
  8 +
5 9 # Index redirects to list action without modifing the url
6 10 def index
7 11 redirect_to :action => 'list'
... ...
app/views/layouts/account.rhtml
1 1 <html>
2 2 <head>
3 3 <%= javascript_include_tag :defaults %>
4   - <%= javascript_include_tag_template @chosen_template %>
5   - <%= stylesheet_link_tag_template @chosen_template %>
  4 + <%= javascript_include_tag_template %>
  5 + <%= stylesheet_link_tag_template %>
6 6  
7 7 </head>
8 8 <body>
... ...
app/views/layouts/virtual_community_admin.rhtml
1 1 <html>
2 2 <head>
3 3 <%= javascript_include_tag :defaults %>
4   - <%= javascript_include_tag_template @chosen_template %>
5   - <%= stylesheet_link_tag_template @chosen_template %>
  4 + <%= javascript_include_tag_template %>
  5 + <%= stylesheet_link_tag_template %>
6 6  
7 7 </head>
8 8 <body>
... ...
lib/extended_tag.rb
... ... @@ -13,7 +13,7 @@ class Tag
13 13 end
14 14 end
15 15  
16   - acts_as_ferret :fields => [:name]
  16 +# acts_as_ferret :fields => [:name]
17 17  
18 18  
19 19 # Return all the tags that were suggested but not yet approved
... ...
test/functional/application_controller_test.rb
... ... @@ -24,20 +24,6 @@ class ApplicationControllerTest &lt; Test::Unit::TestCase
24 24 assert_tag :tag => 'span', :content => 'post_only'
25 25 end
26 26  
27   -
28   - def test_load_template_default
29   - get :index
30   - assert_equal assigns(:chosen_template), 'default'
31   - end
32   -
33   - def test_load_template_other
34   - p = Profile.find(1)
35   - p.template = "other"
36   - p.save
37   - get :index
38   - assert_equal assigns(:chosen_template), 'other'
39   - end
40   -
41 27 def test_exist_owner
42 28 get :index
43 29 assert_not_nil assigns(:owner)
... ... @@ -45,12 +31,16 @@ class ApplicationControllerTest &lt; Test::Unit::TestCase
45 31  
46 32 def test_exist_chosen_theme
47 33 get :index
48   - assert_not_nil assigns(:chosen_theme)
  34 + assert_not_nil assigns(:ft_config)
  35 + conf = assigns(:ft_config)
  36 + assert_not_nil conf[:theme]
49 37 end
50 38  
51 39 def test_exist_chosen_icons_theme
52 40 get :index
53   - assert_not_nil assigns(:chosen_icons_theme)
  41 + assert_not_nil assigns(:ft_config)
  42 + conf = assigns(:ft_config)
  43 + assert_not_nil conf[:icons_theme]
54 44 end
55 45  
56 46 def test_should_generate_help_box_when_passing_string
... ...
test/functional/edit_template_controller_test.rb
... ... @@ -5,15 +5,19 @@ require &#39;edit_template_controller&#39;
5 5 class EditTemplateController; def rescue_action(e) raise e end; end
6 6  
7 7 class EditTemplateControllerTest < Test::Unit::TestCase
  8 +
8 9 def setup
9 10 @controller = EditTemplateController.new
10 11 @request = ActionController::TestRequest.new
11 12 @response = ActionController::TestResponse.new
  13 + @rejected_dirs = ['.', '..', '.svn']
  14 + @theme_dir_path = "#{RAILS_ROOT}/public/themes"
  15 + @icons_dir_path = "#{RAILS_ROOT}/public/icons"
12 16 end
13 17  
14 18 def test_select_theme_html
15 19 get :index
16   - available_themes = Dir.new(ApplicationHelper::THEME_DIR_PATH).to_a - ApplicationHelper::REJECTED_DIRS
  20 + available_themes = Dir.new(@theme_dir_path).to_a - @rejected_dirs
17 21 available_themes.collect do |t|
18 22 assert_tag :tag => 'select', :attributes => {:id => 'theme_name', :name => 'theme_name'}, :child => {:tag =>"option", :attributes => {:value => t}}
19 23 end
... ... @@ -22,7 +26,7 @@ class EditTemplateControllerTest &lt; Test::Unit::TestCase
22 26  
23 27 def test_select_icons_theme_html
24 28 get :index
25   - available_icons = Dir.new(ApplicationHelper::ICONS_DIR_PATH).to_a - ApplicationHelper::REJECTED_DIRS
  29 + available_icons = Dir.new(@icons_dir_path).to_a - @rejected_dirs
26 30 available_icons.collect do |t|
27 31 assert_tag :tag => 'select', :attributes => {:id => 'icons_theme_name', :name => 'icons_theme_name'}, :child => {:tag =>"option", :attributes => {:value => t}}
28 32 end
... ...
test/mocks/test/test_controller.rb
1 1 class TestController < ApplicationController
  2 +
  3 + uses_flexible_template :owner => 'owner'
  4 +
2 5 def index
3 6 render :text => 'index'
4 7 end
... ...