Sha256: 20efb7a521d0d8397acf919153be06394991072d664889bca99ff5251e7d7e8f

Contents?: true

Size: 1.56 KB

Versions: 7

Compression:

Stored size: 1.56 KB

Contents

require_relative '../test_helper'

class ViewHooksIntegrationTest < ActionDispatch::IntegrationTest
  
  def test_hooks_rendering
    Admin::Cms::SitesController.append_view_path(File.expand_path('../fixtures/views', File.dirname(__FILE__)))
    ComfortableMexicanSofa::ViewHooks.add(:navigation, '/nav_hook')
    
    http_auth :get, admin_cms_sites_path
    assert_response :success
    assert_match /hook_content/, response.body
  end
  
  def test_hooks_rendering_with_multiples
    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, 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
    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, 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, admin_cms_sites_path
    assert_response :success
    assert_no_match /hook_content/, response.body
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.11.2 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.11.1 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.11.0 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.10.3 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.10.2 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.10.1 test/integration/view_hooks_test.rb
comfortable_mexican_sofa-1.10.0 test/integration/view_hooks_test.rb