Sha256: af8195d0c2847cf352557199fe110a4eef877726d14873e9129c220e628c68ef

Contents?: true

Size: 1.54 KB

Versions: 2

Compression:

Stored size: 1.54 KB

Contents

require_relative '../test_helper'

class ViewHooksTest < ActionDispatch::IntegrationTest
  
  def test_hooks_rendering
    CmsAdmin::SitesController.append_view_path(File.expand_path('../fixtures/views', File.dirname(__FILE__)))
    ComfortableMexicanSofa::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__)))
    ComfortableMexicanSofa::ViewHooks.add(:navigation, '/nav_hook')
    ComfortableMexicanSofa::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__)))
    ComfortableMexicanSofa::ViewHooks.add(:navigation, '/nav_hook_2', 0)
    ComfortableMexicanSofa::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
    ComfortableMexicanSofa::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
comfortable_mexican_sofa-1.8.5 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.8.4 test/integration/view_hooks_test.rb