From b827a3e87e4b8e5773e19d3a52d05d3c04bf3778 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Tue, 17 Sep 2013 23:11:01 +0000 Subject: [PATCH] rails3: fix boxes_helper tests --- test/unit/boxes_helper_test.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/test/unit/boxes_helper_test.rb b/test/unit/boxes_helper_test.rb index bf3e5b2..0d626b1 100644 --- a/test/unit/boxes_helper_test.rb +++ b/test/unit/boxes_helper_test.rb @@ -1,12 +1,11 @@ require File.dirname(__FILE__) + '/../test_helper' -class BoxesHelperTest < ActiveSupport::TestCase +class BoxesHelperTest < ActionView::TestCase include BoxesHelper include ActionView::Helpers::TagHelper def setup - @controller = mock @controller.stubs(:boxes_editor?).returns(false) @controller.stubs(:uses_design_blocks?).returns(true) end @@ -33,7 +32,7 @@ class BoxesHelperTest < ActiveSupport::TestCase def create_user_with_blocks p = create_user('test_user').person - LinkListBlock.create!(:box => p.boxes.first) + create(LinkListBlock, :box => p.boxes.first) p end @@ -102,13 +101,13 @@ class BoxesHelperTest < ActiveSupport::TestCase end should 'add invisible CSS class name for invisible blocks' do - assert !block_css_classes(Block.new(:display => 'always')).split.any? { |item| item == 'invisible-block'} - assert block_css_classes(Block.new(:display => 'never')).split.any? { |item| item == 'invisible-block'} + assert !block_css_classes(build(Block, :display => 'always')).split.any? { |item| item == 'invisible-block'} + assert block_css_classes(build(Block, :display => 'never')).split.any? { |item| item == 'invisible-block'} end should 'fill context with the article, request_path and locale' do request = mock() - box = Box.create!(:owner => fast_create(Profile)) + box = create(Box, :owner => fast_create(Profile)) request.expects(:path).returns('/') expects(:request).returns(request) expects(:locale).returns('en') -- libgit2 0.21.2