Sha256: 1532a8ada399cacee08134216fc1a7039d79b890460b837a8b502add3ee771b0

Contents?: true

Size: 1.15 KB

Versions: 5

Compression:

Stored size: 1.15 KB

Contents

require 'test_helper'

class CategoryTest < ActiveSupport::TestCase

  setup do
    @category = Category.new :title => 'Test category'
  end  
  
  test "truth" do
    assert_kind_of Class, Category
  end
  
  test "should save meta tags with new_record" do
    value = "title content"
    @category.tag_title = value
    
    assert_equal @category.meta_tag(:title).content, value
    assert_equal @category.meta_tag(:keywords).content, nil
    
    assert_difference('MetaTag.count', 2) do
      @category.save
    end
  end
  
  test "should load meta tags into record" do
    @category.tag_title = "title content"
    @category.tag_keywords = "keywords content"
    @category.save
    
    @category.reload
    
    assert_equal @category.tag_title, "title content"
    assert_equal @category.tag_keywords, "keywords content"
  end
  
  test "should raise error on not valid meta tag method" do
    assert_raise(NoMethodError) do
      @category.tagg_method
    end
  end
  
  test 'should be work with respond_to method' do
    assert @category.respond_to?(:tag_title)
    assert !@category.respond_to?(:tagg_title)
    assert_respond_to(@category, :tag_title)
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/meta_manager-0.0.6/test/models/category_test.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/meta_manager-0.0.6/test/models/category_test.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/meta_manager-0.0.6/test/models/category_test.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/meta_manager-0.0.6/test/models/category_test.rb
meta_manager-0.0.6 test/models/category_test.rb