Sha256: d88119cfe0375eda7e95fdaf9938311244ce947685ae7e295b8e7560889acbea

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

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

class DefaultControllerTest < ActionController::TestCase

  def setup
    @controller = DefaultController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
  end

  context "get home page" do
    setup do
      get :index
    end
    should_respond_with :success
    should_render_template :index # rendering the default home page
  end

  context "requests" do
    setup do
      setup_theme
      get :index
    end
    
    should "not add more than one item to the view path" do
      assert @controller.view_paths.length == 3
    end
    
    context "second request" do
      setup do
        clean_theme_view_path(@controller)
        get :index
      end
      should "not add any more items to the viewpath" do
        assert @controller.view_paths.length == 3
      end
    end
    
    should "have blue in the view path" do
      assert @controller.view_paths[0].to_s.include?('themes/blue/views'), "The blue theme should be first in the view paths but was #{@controller.view_paths[0]}"
    end

  end

  context "multiple requests" do
    setup do
      clean_theme_locale
      @default_locales_length = I18n.load_path.length
      @default_locales_length.freeze
      setup_theme
      get :index
      get :index
      get :index
    end
    should "not add extra locales" do
      assert_equal @default_locales_length + @theme.locales.length, I18n.load_path.length
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
disguise-0.1.3 test/rails_root/test/functional/default_controller_test.rb