ref: master
plugins/site_tour/test/unit/tour_block_test.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
require 'test_helper' class TrackListBlockTest < ActionView::TestCase ActionView::Base.send :include, ApplicationHelper include BoxesHelper def setup @block = fast_create(SiteTourPlugin::TourBlock) end attr_accessor :block should 'do not save empty actions' do block.actions = [{:group_name => '', :selector => nil, :description => ' '}] block.save! assert_equal [], block.actions end should 'render script tag in visualization mode' do controller.expects(:boxes_editor?).returns(false) assert_tag_in_string render_block_content(block), :tag => 'script' end should 'do not render script tag when editing' do controller.expects(:boxes_editor?).returns(true) controller.expects(:uses_design_blocks?).returns(true) assert_no_tag_in_string render_block_content(block), :tag => 'script' end should 'display help button' do controller.expects(:boxes_editor?).returns(false) assert_tag_in_string render_block_content(block), :tag => 'a', :attributes => {:class => 'button icon-help with-text tour-button'} end should 'do not display help button when display_button is false' do block.display_button = false controller.expects(:boxes_editor?).returns(false) assert_no_tag_in_string render_block_content(block), :tag => 'a', :attributes => {:class => 'button icon-help with-text tour-button'} end end |