Sha256: 0176aeb3c865dc1f169fb59ad1b3ebe0dba330c11590675152f57b3f9cf0bed4

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'
require_dependency 'site_controller'

# Re-raise errors caught by the controller.
class SiteController; def rescue_action(e) raise e end; end

class VhostExtensionTest < Test::Unit::TestCase
  fixtures :pages, :page_parts, :sites
  test_helper :pages
  
  def setup
    @controller = SiteController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
    @cache      = @controller.cache
    @cache.perform_caching = false
    @cache.clear
  end
    
  def test_initialization
    assert_equal File.join(File.expand_path(RAILS_ROOT), 'vendor', 'extensions', 'vhost'), VhostExtension.root
    assert_equal 'Vhost', VhostExtension.extension_name
  end  
  
  def test_show_page_differentiates_between_sites
    get :show_page, :url => ''
    assert_response :success
    assert_equal 'This is the body portion of the Ruby home page.', @response.body
    
    @controller = SiteController.new
    @request.host = sites(:two).hostname
    get :show_page, :url => ''
    assert_response :success
    assert_equal 'This is the Rails home page.', @response.body
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
radiant-vhost-extension-2.3.1 test/functional/vhost_extension_test.rb
radiant-vhost-extension-2.3.0 test/functional/vhost_extension_test.rb
radiant-vhost-extension-2.2.0 test/functional/vhost_extension_test.rb
radiant-vhost-extension-2.1.0 test/functional/vhost_extension_test.rb