Sha256: 3f921d64e2e8cf952822d4c890a0fcaf040a936b99791c3a0bee4c8e0ef9c433

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

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

class ViewHooksTest < ActionDispatch::IntegrationTest
  
  def test_hooks_rendering
    CmsAdmin::SitesController.append_view_path(File.expand_path('../fixtures/views', File.dirname(__FILE__)))
    ComfyPress::ViewHooks.add(:navigation, '/nav_hook')
    
    http_auth :get, cms_admin_sites_path
    assert_response :success
    assert_match /hook_content/, response.body
  end
  
  def test_hooks_rendering_with_multiples
    CmsAdmin::SitesController.append_view_path(File.expand_path('../fixtures/views', File.dirname(__FILE__)))
    ComfyPress::ViewHooks.add(:navigation, '/nav_hook')
    ComfyPress::ViewHooks.add(:navigation, '/nav_hook_2')
    
    http_auth :get, cms_admin_sites_path
    assert_response :success
    assert_match /hook_content/, response.body
    assert_match /<hook_content_2>/, response.body
  end

  def test_hooks_rendering_with_proper_order
    CmsAdmin::SitesController.append_view_path(File.expand_path('../fixtures/views', File.dirname(__FILE__)))
    ComfyPress::ViewHooks.add(:navigation, '/nav_hook_2', 0)
    ComfyPress::ViewHooks.add(:navigation, '/nav_hook', 1)
    
    http_auth :get, cms_admin_sites_path
    assert_response :success
    assert_match /<hook_content_2>hook_content/, response.body
  end
  
  def test_hooks_rendering_with_no_hook
    ComfyPress::ViewHooks.remove(:navigation)
    
    http_auth :get, cms_admin_sites_path
    assert_response :success
    assert_no_match /hook_content/, response.body
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
comfypress-0.1.4 test/integration/view_hooks_test.rb
comfypress-0.1.3 test/integration/view_hooks_test.rb