Commit b1ce5ed3f0db1567400a41e316ddf44b5e257e57
1 parent
1f75bc06
Exists in
master
and in
29 other branches
r227@sede: terceiro | 2007-07-28 16:54:55 -0300
ActionItem0: improving test infrastructure git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@231 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
48 additions
and
3 deletions
Show diff stats
@@ -0,0 +1,31 @@ | @@ -0,0 +1,31 @@ | ||
1 | +ActiveRecord::Migration.verbose = false | ||
2 | + | ||
3 | +ActiveRecord::Schema.define(:version => 0) do | ||
4 | + | ||
5 | + create_table :design_test_design_boxes, :force => true do |t| | ||
6 | + t.column :name, :string | ||
7 | + t.column :title, :string | ||
8 | + t.column :number, :integer | ||
9 | + t.column :owner_type, :string | ||
10 | + t.column :owner_id, :integer | ||
11 | + end | ||
12 | + | ||
13 | + create_table :design_test_design_blocks, :force => true do |t| | ||
14 | + t.column :name, :string | ||
15 | + t.column :title, :string | ||
16 | + t.column :box_id, :integer | ||
17 | + t.column :position, :integer | ||
18 | + t.column :type, :string | ||
19 | + t.column :helper, :string | ||
20 | + end | ||
21 | + | ||
22 | + create_table :design_test_users, :force => true do |t| | ||
23 | + t.column :name, :string, :limit => 80 | ||
24 | + end | ||
25 | + | ||
26 | +end | ||
27 | + | ||
28 | +ActiveRecord::Migration.verbose = true | ||
29 | + | ||
30 | + | ||
31 | + |
vendor/plugins/design/test/test_helper.rb
@@ -3,15 +3,29 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environme | @@ -3,15 +3,29 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environme | ||
3 | 3 | ||
4 | require 'test/unit' | 4 | require 'test/unit' |
5 | 5 | ||
6 | +# load the database schema for the tests | ||
7 | +ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log") | ||
8 | +load(File.dirname(__FILE__) + '/schema.rb') | ||
9 | +# change the table names for the tests to not touch | ||
10 | +Design::Box.set_table_name 'design_test_design_boxes' | ||
11 | +Design::Block.set_table_name 'design_test_design_blocks' | ||
12 | + | ||
13 | +# example class to hold some blocks | ||
14 | +class DesignTestUser < ActiveRecord::Base | ||
15 | + set_table_name 'design_test_users' | ||
16 | + | ||
17 | + acts_as_design | ||
18 | +end | ||
19 | + | ||
6 | ######################## | 20 | ######################## |
7 | # test clases below here | 21 | # test clases below here |
8 | ######################## | 22 | ######################## |
9 | 23 | ||
10 | class FixedDesignTestController < ActionController::Base | 24 | class FixedDesignTestController < ActionController::Base |
11 | 25 | ||
12 | - BOX1 = Box.new | ||
13 | - BOX2 = Box.new | ||
14 | - BOX3 = Box.new | 26 | + BOX1 = Design::Box.new |
27 | + BOX2 = Design::Box.new | ||
28 | + BOX3 = Design::Box.new | ||
15 | 29 | ||
16 | design :fixed => { | 30 | design :fixed => { |
17 | :template => 'some_template', | 31 | :template => 'some_template', |