Sha256: 518e3d732279ddc42dc4197d0931cdecc3f91c23a9c1e85373b0a6b04c5e98b2

Contents?: true

Size: 1.07 KB

Versions: 7

Compression:

Stored size: 1.07 KB

Contents

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

class CmsSiteTest < ActiveSupport::TestCase
  
  def test_fixtures_validity
    CmsSite.all.each do |site|
      assert site.valid?, site.errors.full_messages
    end
  end
  
  def test_validation
    site = CmsSite.new
    assert site.invalid?
    assert_has_errors_on site, [:label, :hostname]
    
    site = CmsSite.new(:label => 'My Site', :hostname => 'http://mysite.com')
    assert site.invalid?
    assert_has_errors_on site, :hostname
    
    site = CmsSite.new(:label => 'My Site', :hostname => 'mysite.com')
    assert site.valid?
  end
  
  def test_cascading_destroy
    assert_difference 'CmsSite.count', -1 do
      assert_difference 'CmsLayout.count', -3 do
        assert_difference 'CmsPage.count', -2 do
          assert_difference 'CmsSnippet.count', -1 do
            cms_sites(:default).destroy
          end
        end
      end
    end
  end
  
  def test_options_for_select
    assert_equal 1, CmsSite.options_for_select.size
    assert_equal 'Default Site (test.host)', CmsSite.options_for_select[0][0]
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.0.9 test/unit/cms_site_test.rb
comfortable_mexican_sofa-1.0.7 test/unit/cms_site_test.rb
comfortable_mexican_sofa-1.0.6 test/unit/cms_site_test.rb
comfortable_mexican_sofa-1.0.5 test/unit/cms_site_test.rb
comfortable_mexican_sofa-1.0.4 test/unit/cms_site_test.rb
comfortable_mexican_sofa-1.0.3 test/unit/cms_site_test.rb
comfortable_mexican_sofa-1.0.2 test/unit/cms_site_test.rb