Commit 63f275e7a7ce22e36c4bdad80abddb427ddeb8e8

Authored by AntonioTerceiro
1 parent 6a5e4e61

r230@sede: terceiro | 2007-07-28 17:03:52 -0300

ActionItem0: adding MainBlock from old flexible_template
 


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@234 3f533792-8f58-4932-b0fe-aaf55b0a4547
vendor/plugins/design/lib/design/main_block.rb 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +module Design
  2 +
  3 + # Block subclass to represent blocks that must contain the main content, i.e.
  4 + # the result of the controller action, or yet, the value you would get by
  5 + # calling +yield+ inside a regular view.
  6 + class MainBlock < Block
  7 +
  8 + set_table_name
  9 +
  10 + # always returns true
  11 + def main?
  12 + true
  13 + end
  14 +
  15 + end
  16 +
  17 +end
... ...
vendor/plugins/design/test/main_block_test.rb 0 → 100644
... ... @@ -0,0 +1,11 @@
  1 +require File.dirname(__FILE__) + '/test_helper'
  2 +
  3 +class MainBlockTest < Test::Unit::TestCase
  4 +
  5 + include Design
  6 +
  7 + def test_main_should_always_return_true
  8 + assert_equal true, MainBlock.new.main?
  9 + end
  10 +
  11 +end
... ...
vendor/plugins/design/test/test_helper.rb
... ... @@ -8,7 +8,9 @@ ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + &quot;/debug.log&quot;)
8 8 load(File.dirname(__FILE__) + '/schema.rb')
9 9 # change the table names for the tests to not touch
10 10 Design::Box.set_table_name 'design_test_design_boxes'
11   -Design::Block.set_table_name 'design_test_design_blocks'
  11 +[Design::Block, Design::MainBlock].each do |item|
  12 + item.set_table_name 'design_test_design_blocks'
  13 +end
12 14  
13 15 # example class to hold some blocks
14 16 class DesignTestUser < ActiveRecord::Base
... ...