Sha256: dbf80d91b7674949bc525251174e6f66fc4040cfda67cbfcc1421fa14d44964f

Contents?: true

Size: 1.14 KB

Versions: 13

Compression:

Stored size: 1.14 KB

Contents

require 'test_helper'

class DomainThemeTest < ActiveSupport::TestCase

  context "theme" do
    setup do
      @domain_theme = Factory(:domain_theme)
    end
    should_validate_presence_of :name, :uri
  end

  context "theme by request" do
    setup do
      @valid_uri = 'green.example.com'
      @invalid_uri = 'red.example.com'
      @request = mock()
      @domain_theme = Factory(:domain_theme, :name => 'green', :uri => @valid_uri)
    end

    context "valid url" do
      setup do
        @request.stubs(:host).returns(@valid_uri)
      end
      should "find the green theme" do
        assert_equal 'green', DomainTheme.get_theme(@request).name
      end
      should "find the green domain theme" do
        assert_equal @domain_theme, DomainTheme.get_domain_theme(@request)
      end
    end
    
    context "invalid url" do
      setup do
        @request.stubs(:host).returns(@invalid_uri)
      end
      should "not find the theme" do
        assert_nil DomainTheme.get_theme(@request)
      end
      should "not find the domain theme" do
        assert_not_equal @domain_theme, DomainTheme.get_domain_theme(@request)
      end
    end
  end
  
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
disguise-2.0.0 test/rails_root/test/unit/domain_theme_test.rb
disguise-0.4.0 test/rails_root/test/unit/domain_theme_test.rb
disguise-0.3.12 test/rails_root/test/unit/domain_theme_test.rb
disguise-0.3.11 test/rails_root/test/unit/domain_theme_test.rb
disguise-0.3.10 test/rails_root/test/unit/domain_theme_test.rb
disguise-0.3.8 test/rails_root/test/unit/domain_theme_test.rb
disguise-0.3.7 test/rails_root/test/unit/domain_theme_test.rb
disguise-0.3.6 test/rails_root/test/unit/domain_theme_test.rb
disguise-0.3.1 test/rails_root/test/unit/domain_theme_test.rb
disguise-0.3.2 test/rails_root/test/unit/domain_theme_test.rb
disguise-0.3.3 test/rails_root/test/unit/domain_theme_test.rb
disguise-0.3.4 test/rails_root/test/unit/domain_theme_test.rb
disguise-0.3.5 test/rails_root/test/unit/domain_theme_test.rb