Sha256: c79ac2fc6b2720729027a41c1a86d93fafc75d44908b17923eecce7bb734b198

Contents?: true

Size: 1.57 KB

Versions: 11

Compression:

Stored size: 1.57 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__)))
    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

11 entries across 11 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.6.31 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.8.3 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.8.2 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.8.1 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.8.0 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.6.30 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.7.3 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.7.1 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.7.0 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.6.26 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.6.25 test/integration/view_hooks_test.rb