Commit b827a3e87e4b8e5773e19d3a52d05d3c04bf3778
1 parent
e803bf2c
Exists in
master
and in
27 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 | 1 | require File.dirname(__FILE__) + '/../test_helper' |
| 2 | 2 | |
| 3 | -class BoxesHelperTest < ActiveSupport::TestCase | |
| 3 | +class BoxesHelperTest < ActionView::TestCase | |
| 4 | 4 | |
| 5 | 5 | include BoxesHelper |
| 6 | 6 | include ActionView::Helpers::TagHelper |
| 7 | 7 | |
| 8 | 8 | def setup |
| 9 | - @controller = mock | |
| 10 | 9 | @controller.stubs(:boxes_editor?).returns(false) |
| 11 | 10 | @controller.stubs(:uses_design_blocks?).returns(true) |
| 12 | 11 | end |
| ... | ... | @@ -33,7 +32,7 @@ class BoxesHelperTest < ActiveSupport::TestCase |
| 33 | 32 | |
| 34 | 33 | def create_user_with_blocks |
| 35 | 34 | p = create_user('test_user').person |
| 36 | - LinkListBlock.create!(:box => p.boxes.first) | |
| 35 | + create(LinkListBlock, :box => p.boxes.first) | |
| 37 | 36 | p |
| 38 | 37 | end |
| 39 | 38 | |
| ... | ... | @@ -102,13 +101,13 @@ class BoxesHelperTest < ActiveSupport::TestCase |
| 102 | 101 | end |
| 103 | 102 | |
| 104 | 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 | 106 | end |
| 108 | 107 | |
| 109 | 108 | should 'fill context with the article, request_path and locale' do |
| 110 | 109 | request = mock() |
| 111 | - box = Box.create!(:owner => fast_create(Profile)) | |
| 110 | + box = create(Box, :owner => fast_create(Profile)) | |
| 112 | 111 | request.expects(:path).returns('/') |
| 113 | 112 | expects(:request).returns(request) |
| 114 | 113 | expects(:locale).returns('en') | ... | ... |