Sha256: 3800247b90fac60147b2a982c1ae34da0d9061af499acf41c874108459fb2c65

Contents?: true

Size: 1.47 KB

Versions: 13

Compression:

Stored size: 1.47 KB

Contents

require 'test_helper'

module Guts
  class CategoryTest < ActiveSupport::TestCase
    test 'should not create without title' do
      category = Category.new
      
      assert_not category.save
    end
    
    test 'should not create with title less than three characters' do
      category       = Category.new
      category.title = '12' 
      
      assert_not category.save
    end
    
    test 'should create slug for title' do
      category       = Category.new
      category.title = 'Super Duper Category!' 
      category.save
      
      assert_equal 'super-duper-category', category.slug
    end
    
    test 'should return navigatable format' do
      assert_equal ':title', Category.navigatable_opts[:format]
      assert_equal [:title], Category.navigatable_opts[:variables]
      
      category = guts_categories :test_category
      assert_equal 'Super Category!', category.navigatable_format
    end
    
    test 'should return contents for category' do
      category = guts_categories :test_category
      
      assert_operator category.contents.size, :>, 0
    end
    
    test 'should return metafields for category' do
      category = guts_categories :test_category
      
      assert_operator category.metafields.size, :>, 0
    end
    
    test 'should be trackable' do
      assert_equal true, Category.methods.include?(:trackable)
    end
    
    test 'category should be multisite compatible' do
      assert Category.all.to_sql.include?('site_id')
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
guts-1.4.0 test/models/guts/category_test.rb
guts-1.3.6 test/models/guts/category_test.rb
guts-1.3.5 test/models/guts/category_test.rb
guts-1.3.4 test/models/guts/category_test.rb
guts-1.3.3 test/models/guts/category_test.rb
guts-1.3.2 test/models/guts/category_test.rb
guts-1.3.1 test/models/guts/category_test.rb
guts-1.3.0 test/models/guts/category_test.rb
guts-1.2.2 test/models/guts/category_test.rb
guts-1.2.1 test/models/guts/category_test.rb
guts-1.2.0 test/models/guts/category_test.rb
guts-1.1.1 test/models/guts/category_test.rb
guts-1.1.0 test/models/guts/category_test.rb