Sha256: a9c9397ff3703318967a16b24b03b01ca2423e99ce8507756deb396b5094b8f2
Contents?: true
Size: 1016 Bytes
Versions: 6
Compression:
Stored size: 1016 Bytes
Contents
require_relative '../../test_helper' 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, [:site_id, :label, :categorized_type] end def test_creation assert_difference 'Cms::Category.count' do cms_sites(:default).categories.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
6 entries across 6 versions & 1 rubygems