Sha256: 999af656a3e5b9bb36ca5009914b93a7c31f3f5d448da90ea5430ccbaa5273b6

Contents?: true

Size: 1022 Bytes

Versions: 35

Compression:

Stored size: 1022 Bytes

Contents

require File.expand_path('../../test_helper', File.dirname(__FILE__))

class CmsCategoryTest < ActiveSupport::TestCase
  
  def test_fixtures_validity
    Cms::Category.all.each do |category|
      assert category.valid?, category.errors.full_messages.to_s
    end
  end
  
  def test_validation
    category = Cms::Category.new
    assert category.invalid?
    assert_has_errors_on category, [:label, :categorized_type]
  end
  
  def test_creation
    assert_difference 'Cms::Category.count' do
      Cms::Category.create(
        :label => 'Test Category',
        :categorized_type => 'Cms::Snippet'
      )
    end
  end
  
  def test_destruction
    category = cms_categories(:default)
    assert_equal 1, category.categorizations.count
    assert_difference ['Cms::Category.count', 'Cms::Categorization.count'], -1 do
      category.destroy
    end
  end
  
  def test_scope_of_type
    assert_equal 1, Cms::Category.of_type('Cms::File').count
    assert_equal 0, Cms::Category.of_type('Invalid').count
  end
  
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.5.11 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.5.10 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.5.9 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.5.8 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.5.7 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.5.6 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.5.5 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.5.4 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.5.3 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.5.2 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.5.1 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.5.0 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.4.22 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.4.21 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.4.20 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.4.19 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.4.18 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.4.17 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.4.16 test/unit/models/category_test.rb
comfortable_mexican_sofa-1.4.15 test/unit/models/category_test.rb