Sha256: 3d0ba010443db1de978c4fb3df9cd0341b4c4fcc4ed09b64ff9fbb0a09a37f33

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

require File.join(File.dirname(__FILE__), '/../../test_helper')

class Cms::PortletsControllerTest < ActionController::TestCase
  include Cms::ControllerTestHelper
    
  def setup
    login_as_cms_admin
    @block = DynamicPortlet.create!(:name => "V1", :code => "@foo = 42", :template => "<%= @foo %>")    
  end
  
  def test_index
    get :index
    assert_response :success
    assert_select "#dynamic_portlet_#{@block.id}"
  end
  
  def test_index_does_not_show_deleted_portlets
    @block.destroy
    get :index
    assert_response :success
    assert_select "#dynamic_portlet_#{@block.id}", 0
  end
    
  def test_show
    get :show, :id => @block.id
    assert_response :success
    assert_select "a#revisions_link", false
  end
  
  def test_new
    get :new
    assert_response :success
    assert_select "title", "Content Library / Select Portlet Type"
  end
  
  def test_edit
    get :edit, :id => @block.id
    assert_response :success
    assert_select "title", "Content Library / Edit Portlet"
    assert_select "h1", "Edit Portlet 'V1'"
  end  
  
  def test_destroy
    delete :destroy, :id => @block.id
    assert_redirected_to cms_portlets_path
    assert_raise(ActiveRecord::RecordNotFound) { DynamicPortlet.find(@block.id) }
  end


  # Doesn't really belong here, but I'm not sure how else to test the behavior of the form_builders
  def test_form_helpers_which_use_instructions
    get :new, :type=>"login_portlet"
    assert_response :success
    assert_select "div.instructions", "Leave blank to send the user to the page they were trying to access"

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
browsercms-3.0.0 test/functional/cms/portlets_controller_test.rb