Commit b827a3e87e4b8e5773e19d3a52d05d3c04bf3778
1 parent
e803bf2c
Exists in
master
and in
29 other branches
rails3: fix boxes_helper tests
Showing
1 changed file
with
5 additions
and
6 deletions
Show diff stats
test/unit/boxes_helper_test.rb
1 | require File.dirname(__FILE__) + '/../test_helper' | 1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | 2 | ||
3 | -class BoxesHelperTest < ActiveSupport::TestCase | 3 | +class BoxesHelperTest < ActionView::TestCase |
4 | 4 | ||
5 | include BoxesHelper | 5 | include BoxesHelper |
6 | include ActionView::Helpers::TagHelper | 6 | include ActionView::Helpers::TagHelper |
7 | 7 | ||
8 | def setup | 8 | def setup |
9 | - @controller = mock | ||
10 | @controller.stubs(:boxes_editor?).returns(false) | 9 | @controller.stubs(:boxes_editor?).returns(false) |
11 | @controller.stubs(:uses_design_blocks?).returns(true) | 10 | @controller.stubs(:uses_design_blocks?).returns(true) |
12 | end | 11 | end |
@@ -33,7 +32,7 @@ class BoxesHelperTest < ActiveSupport::TestCase | @@ -33,7 +32,7 @@ class BoxesHelperTest < ActiveSupport::TestCase | ||
33 | 32 | ||
34 | def create_user_with_blocks | 33 | def create_user_with_blocks |
35 | p = create_user('test_user').person | 34 | p = create_user('test_user').person |
36 | - LinkListBlock.create!(:box => p.boxes.first) | 35 | + create(LinkListBlock, :box => p.boxes.first) |
37 | p | 36 | p |
38 | end | 37 | end |
39 | 38 | ||
@@ -102,13 +101,13 @@ class BoxesHelperTest < ActiveSupport::TestCase | @@ -102,13 +101,13 @@ class BoxesHelperTest < ActiveSupport::TestCase | ||
102 | end | 101 | end |
103 | 102 | ||
104 | should 'add invisible CSS class name for invisible blocks' do | 103 | should 'add invisible CSS class name for invisible blocks' do |
105 | - assert !block_css_classes(Block.new(:display => 'always')).split.any? { |item| item == 'invisible-block'} | ||
106 | - assert block_css_classes(Block.new(:display => 'never')).split.any? { |item| item == 'invisible-block'} | 104 | + assert !block_css_classes(build(Block, :display => 'always')).split.any? { |item| item == 'invisible-block'} |
105 | + assert block_css_classes(build(Block, :display => 'never')).split.any? { |item| item == 'invisible-block'} | ||
107 | end | 106 | end |
108 | 107 | ||
109 | should 'fill context with the article, request_path and locale' do | 108 | should 'fill context with the article, request_path and locale' do |
110 | request = mock() | 109 | request = mock() |
111 | - box = Box.create!(:owner => fast_create(Profile)) | 110 | + box = create(Box, :owner => fast_create(Profile)) |
112 | request.expects(:path).returns('/') | 111 | request.expects(:path).returns('/') |
113 | expects(:request).returns(request) | 112 | expects(:request).returns(request) |
114 | expects(:locale).returns('en') | 113 | expects(:locale).returns('en') |