Sha256: 1bbdc80ffc2f7b1bbe53734863201c0162bbf1827b5fa111b49d583d6c81619c

Contents?: true

Size: 1.68 KB

Versions: 11

Compression:

Stored size: 1.68 KB

Contents

require_relative '../test_helper'

class ViewHooksIntegrationTest < ActionDispatch::IntegrationTest
  
  def teardown
    ComfortableMexicanSofa::ViewHooks.remove(:navigation)
  end
  
  def test_hooks_rendering
    Comfy::Admin::Cms::SitesController.append_view_path(File.expand_path('../fixtures/views', File.dirname(__FILE__)))
    ComfortableMexicanSofa::ViewHooks.add(:navigation, '/nav_hook')
    
    http_auth :get, comfy_admin_cms_sites_path
    assert_response :success
    assert_match /hook_content/, response.body
  end
  
  def test_hooks_rendering_with_multiples
    Comfy::Admin::Cms::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, comfy_admin_cms_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
    Comfy::Admin::Cms::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, comfy_admin_cms_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, comfy_admin_cms_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.12.11 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.12.10 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.12.9 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.12.8 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.12.7 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.12.6 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.12.5 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.12.4 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.12.3 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.12.2 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.12.1 test/integration/view_hooks_test.rb