Commit ff69a878662aab690ce367c4e5565681136795df

Authored by LeandroNunes
1 parent 9ede168f

ActionItem0: updating tests and making refactoring of desgin plugin

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@313 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/edit_template_controller.rb
1 1 class EditTemplateController < ApplicationController
2 2  
3   - design_editor :holder => 'virtual_community', :autosave => true, :block_types => :block_types
4   -
5   - #TODO Implements the available blocks here
6   - #TODO implements available helpers
  3 + design_editor :holder => 'virtual_community', :autosave => true, :block_types => :block_types, :block_helper_types => :block_helper_types
  4 +
  5 + def block_types
  6 + {
  7 + 'ListBlock' => _("List Block"),
  8 + 'LinkBlock' => _("Link Block"),
  9 + }
  10 + end
  11 +
  12 + def block_helper_types
  13 + {
  14 + 'list_content' => _("Simple List Content"),
  15 + 'plain_content' => _("Link Block"),
  16 + }
  17 + end
7 18  
8 19 def index
9 20 redirect_to :action => 'design_editor'
10 21 end
11 22  
12   - FLEXIBLE_TEMPLATE_AVAILABLE_BLOCKS = {
13   - 'ListBlock' => _("List Block"),
14   - 'LinkBlock' => _("Link Block"),
15   - }
16   -
17   -
18   -#TODO add your own helpers here
19   -# FLEXIBLE_TEMPLATE_BLOCK_HELPER = {
20   -# 'list_content' => _("Simple List Content"),
21   -# }
22   -
23   -
24 23 end
... ...
app/models/list_block.rb
1   -class ListBlock < Block
  1 +class ListBlock < Design::Block
2 2  
3 3 def content
4 4 Profile.find(:all).map{|p|p.name}
... ...
test/functional/edit_template_controller_test.rb
... ... @@ -14,8 +14,10 @@ class EditTemplateControllerTest &lt; Test::Unit::TestCase
14 14 @response = ActionController::TestResponse.new
15 15 end
16 16  
17   - def test
18   - flunk 'FIXME: nothing tested yet'
  17 + def test_redirect_to_design_editoe_when_index_action_is_called
  18 + get :index
  19 + assert_response :redirect
  20 + assert_redirected_to :action => 'design_editor'
19 21 end
20 22  
21 23 end
... ...