Sha256: f89ab41f809bd0cfdda0fc7096bf9c0896d070d9f0b32c6dd01578b646d812a6

Contents?: true

Size: 1.52 KB

Versions: 6

Compression:

Stored size: 1.52 KB

Contents

require 'test_helper'

module Cms
class FileBlocksControllerTest < ActionController::TestCase
  include Cms::ControllerTestHelper

  def setup
    given_a_site_exists
    login_as_cms_admin
    given_there_is_a_content_type(Cms::FileBlock)
  end
  
  def test_file_block_search
    @file = mock_file()
    @file_block = Factory(:file_block, :attachment_section => root_section, 
      :attachment_file => @file, 
      :attachment_file_path => "/test.txt", 
      :name => "Test File", 
      :publish_on_save => true)
    @foo_section = Factory(:section, :name => "Foo", :parent => root_section)

    get :index, :section_id => root_section.id
    assert_response :success
    assert_select "td", "Test File"

    get :index, :section_id => @foo_section.id
    assert_response :success
    assert_select "td", {:count => 0, :text => "Test File"}

    get :index, :section_id => 'all'
    assert_response :success
    assert_select "td", "Test File"
  end

  #
  # Fix for #33
  #
  def test_view_file_block_doesnt_have_view_error
    @file = mock_file()
    @file_block = Factory(:file_block, :attachment_section => root_section,
      :attachment_file => @file,
      :attachment_file_path => "/test.txt",
      :name => "Test File",
      :publish_on_save => true)
    @foo_section = Factory(:section, :name => "Foo", :parent => root_section)

    get :show, :id => @file_block.id

    assert_response :success
    assert_select "div#file_block_#{@file_block.id}", true, "Should render the file_blocks/render.html.erb partial correctly."

  end

end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
browsercms-3.4.2 test/functional/cms/file_blocks_controller_test.rb
browsercms-3.4.2.rc1 test/functional/cms/file_blocks_controller_test.rb
browsercms-3.4.1 test/functional/cms/file_blocks_controller_test.rb
browsercms-3.4.0 test/functional/cms/file_blocks_controller_test.rb
browsercms-3.4.0.rc2 test/functional/cms/file_blocks_controller_test.rb
browsercms-3.4.0.rc1 test/functional/cms/file_blocks_controller_test.rb