Commit edb0955b6c939b14f5648608cee9c463258a9bb0

Authored by LeandroNunes
1 parent e34e8a43

ActionItem0: fixing bugs in test of blocks

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@292 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/views/layouts/application.rhtml
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 <div id="footer"> 34 <div id="footer">
35 <a name='footer'/></a> 35 <a name='footer'/></a>
36 <%= footer %> 36 <%= footer %>
37 - <%= design_display_icon('back',"" , :action => 'list')%> 37 + <%= design_display_icon('back', _('Back') , :action => 'list')%>
38 </div> 38 </div>
39 </div> 39 </div>
40 </div> 40 </div>
test/unit/block_test.rb
1 require File.dirname(__FILE__) + '/../test_helper' 1 require File.dirname(__FILE__) + '/../test_helper'
2 2
3 class BlockTest < Test::Unit::TestCase 3 class BlockTest < Test::Unit::TestCase
4 - fixtures :blocks, :profiles 4 + fixtures :design_blocks, :profiles
5 5
6 def setup 6 def setup
7 @profile = Profile.find(1) 7 @profile = Profile.find(1)
@@ -10,53 +10,53 @@ class BlockTest &lt; Test::Unit::TestCase @@ -10,53 +10,53 @@ class BlockTest &lt; Test::Unit::TestCase
10 def test_setup_assumptions 10 def test_setup_assumptions
11 assert @profile.valid? 11 assert @profile.valid?
12 end 12 end
13 -  
14 - # Replace this with your real tests.  
15 - def test_create  
16 - count = Block.count  
17 - b = Block.new  
18 - assert !b.valid?  
19 - assert b.errors.invalid?(:box_id)  
20 - assert b.errors.invalid?(:position)  
21 -  
22 - box = Box.new  
23 - box.owner = @profile  
24 - box.number = 1000  
25 - assert box.save  
26 - b.box = box  
27 - assert !b.valid?  
28 - assert b.errors.invalid?(:position)  
29 -  
30 - b.position=1  
31 - assert b.save  
32 -  
33 - assert_equal count + 1, Block.count  
34 - end  
35 -  
36 - def test_box_presence  
37 - b = Block.new  
38 - b.position = 1000  
39 - assert !b.valid?  
40 - assert b.errors.invalid?(:box_id)  
41 -  
42 - box = Box.new  
43 - box.owner = @profile  
44 - box.number = 1000  
45 - assert box.save  
46 - b.box = box  
47 - assert b.valid?  
48 -  
49 - end  
50 -  
51 - def test_destroy  
52 - b = Block.find(1)  
53 - assert b.destroy  
54 - end  
55 -  
56 - def test_valid_fixtures  
57 - Block.find(:all).each do |b|  
58 - assert b.valid?  
59 - end  
60 - end 13 +#TODO remove it this tests are now on design plugin
  14 +# # Replace this with your real tests.
  15 +# def test_create
  16 +# count = Block.count
  17 +# b = Block.new
  18 +# assert !b.valid?
  19 +# assert b.errors.invalid?(:box_id)
  20 +# assert b.errors.invalid?(:position)
  21 +#
  22 +# box = Box.new
  23 +# box.owner = @profile
  24 +# box.number = 1000
  25 +# assert box.save
  26 +# b.box = box
  27 +# assert !b.valid?
  28 +# assert b.errors.invalid?(:position)
  29 +#
  30 +# b.position=1
  31 +# assert b.save
  32 +#
  33 +# assert_equal count + 1, Block.count
  34 +# end
  35 +#
  36 +# def test_box_presence
  37 +# b = Block.new
  38 +# b.position = 1000
  39 +# assert !b.valid?
  40 +# assert b.errors.invalid?(:box_id)
  41 +#
  42 +# box = Box.new
  43 +# box.owner = @profile
  44 +# box.number = 1000
  45 +# assert box.save
  46 +# b.box = box
  47 +# assert b.valid?
  48 +#
  49 +# end
  50 +#
  51 +# def test_destroy
  52 +# b = Block.find(1)
  53 +# assert b.destroy
  54 +# end
  55 +#
  56 +# def test_valid_fixtures
  57 +# Block.find(:all).each do |b|
  58 +# assert b.valid?
  59 +# end
  60 +# end
61 61
62 end 62 end
test/unit/box_test.rb
1 require File.dirname(__FILE__) + '/../test_helper' 1 require File.dirname(__FILE__) + '/../test_helper'
2 2
3 class BoxTest < Test::Unit::TestCase 3 class BoxTest < Test::Unit::TestCase
4 - fixtures :boxes, :blocks, :profiles 4 + fixtures :design_boxes, :design_blocks, :profiles
5 5
6 def setup 6 def setup
7 @owner = Profile.find(1) 7 @owner = Profile.find(1)
@@ -10,55 +10,55 @@ class BoxTest &lt; Test::Unit::TestCase @@ -10,55 +10,55 @@ class BoxTest &lt; Test::Unit::TestCase
10 def test_setup 10 def test_setup
11 assert @owner.valid? 11 assert @owner.valid?
12 end 12 end
13 -  
14 - def test_destroy  
15 - count = Box.count  
16 - assert Box.find(1).destroy  
17 - assert_equal count - 1, Box.count  
18 - end  
19 -  
20 - def test_create  
21 - count = Box.count  
22 - b = Box.new  
23 - b.owner = @owner  
24 - assert b.save  
25 - assert count + 1, Box.count  
26 - end  
27 -  
28 -  
29 - def test_number_format  
30 - b = Box.new  
31 - b.number = "none"  
32 - assert !b.valid?  
33 - assert b.errors.invalid?(:number)  
34 -  
35 - b = Box.new  
36 - b.number = 10.2  
37 - assert !b.save  
38 -  
39 - b = Box.new  
40 - b.owner = @owner  
41 - assert b.save  
42 -  
43 - end  
44 -  
45 - def test_unique_number  
46 - assert Box.delete_all  
47 - b = Box.new  
48 - b.owner = @owner  
49 - assert b.save  
50 -  
51 - b = Box.new  
52 - b.owner = @owner  
53 - b.number = 1  
54 - assert !b.valid?  
55 - assert b.errors.invalid?(:number)  
56 - end  
57 -  
58 - def test_presence_number  
59 - b = Box.new(:number => nil)  
60 - assert !b.valid?  
61 - assert b.errors.invalid?(:number)  
62 - end 13 +#TODO remove this file these tests are now on desgin plugin
  14 +# def test_destroy
  15 +# count = Box.count
  16 +# assert Box.find(1).destroy
  17 +# assert_equal count - 1, Box.count
  18 +# end
  19 +#
  20 +# def test_create
  21 +# count = Box.count
  22 +# b = Box.new
  23 +# b.owner = @owner
  24 +# assert b.save
  25 +# assert count + 1, Box.count
  26 +# end
  27 +#
  28 +#
  29 +# def test_number_format
  30 +# b = Box.new
  31 +# b.number = "none"
  32 +# assert !b.valid?
  33 +# assert b.errors.invalid?(:number)
  34 +#
  35 +# b = Box.new
  36 +# b.number = 10.2
  37 +# assert !b.save
  38 +#
  39 +# b = Box.new
  40 +# b.owner = @owner
  41 +# assert b.save
  42 +#
  43 +# end
  44 +#
  45 +# def test_unique_number
  46 +# assert Box.delete_all
  47 +# b = Box.new
  48 +# b.owner = @owner
  49 +# assert b.save
  50 +#
  51 +# b = Box.new
  52 +# b.owner = @owner
  53 +# b.number = 1
  54 +# assert !b.valid?
  55 +# assert b.errors.invalid?(:number)
  56 +# end
  57 +#
  58 +# def test_presence_number
  59 +# b = Box.new(:number => nil)
  60 +# assert !b.valid?
  61 +# assert b.errors.invalid?(:number)
  62 +# end
63 63
64 end 64 end
test/unit/link_block_test.rb
1 require File.dirname(__FILE__) + '/../test_helper' 1 require File.dirname(__FILE__) + '/../test_helper'
2 2
3 class LinkBlockTest < Test::Unit::TestCase 3 class LinkBlockTest < Test::Unit::TestCase
4 - fixtures :blocks 4 + fixtures :design_blocks
5 5
6 # Replace this with your real tests. 6 # Replace this with your real tests.
7 def test_content 7 def test_content
test/unit/list_block_test.rb
1 require File.dirname(__FILE__) + '/../test_helper' 1 require File.dirname(__FILE__) + '/../test_helper'
2 2
3 class ListBlockTest < Test::Unit::TestCase 3 class ListBlockTest < Test::Unit::TestCase
4 - fixtures :blocks 4 + fixtures :design_blocks
5 5
6 # Replace this with your real tests. 6 # Replace this with your real tests.
7 def test_truth 7 def test_truth