Sha256: b43e096c4183d67c090c918da548d89849dc7f437f1207249530428d48cda0ea

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

require "test_helper"

module Guts
  class TypeTest < ActiveSupport::TestCase
    test "should not create without title" do
      type = Type.new
      
      assert_not type.save
    end
    
    test "should not create with title less than three characters" do
      type       = Type.new
      type.title = "12" 
      
      assert_not type.save
    end
    
    test "should create slug for title" do
      type       = Type.new
      type.title = "i am a type good sir" 
      type.save
      
      assert_equal "i-am-a-type-good-sir", type.slug
    end
    
    test "should return navigatable format" do
      assert_equal ":title", Type.navigatable_opts[:format]
      assert_equal [:title], Type.navigatable_opts[:variables]
      
      type = guts_types :page_type
      assert_equal "Page", type.navigatable_format
    end

    test "should return contents for type" do
      type    = guts_types :page_type
      content = guts_contents :test_page
      
      assert_includes type.contents, content
    end
    
    test "should return metafields for type" do
      type = guts_types :page_type
      
      assert_operator type.metafields.size, :>, 0
    end
    
    test "should be trackable" do
      assert_equal true, Type.methods.include?(:trackable)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
guts-1.0.8 test/models/guts/type_test.rb
guts-1.0.7 test/models/guts/type_test.rb
guts-1.0.5 test/models/guts/type_test.rb
guts-1.0.3 test/models/guts/type_test.rb