Sha256: 45d1b0ca894fa36fadac65253e2a12f2d707e2b9575c8c7c3267c347ec18fb98

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require 'helper'
require 'shoulda/active_record/matchers'
require 'shoulda/active_record/macros'

load_schema

class Article < ActiveRecord::Base
  typograf(:content)
  typograf(:title => {:use_p => false, :use_br => false})
  typograf(:skills, :achievements, :description, :use_br => false)
end

class ArticleTest < ActiveSupport::TestCase
  extend Shoulda::ActiveRecord::Macros

  should_have_class_methods :typograf
  should_have_instance_methods :typograf_fields, :typograf_current_fields

  should 'load schema correctly' do
    assert_equal [], Article.all
  end

  context 'with an Article' do
    setup do
      @article = Article.create(:title => '- Does it "Article"?',
                                :content => 'Yes, this is an "Article"...')
      AlsTypograf.default_options!
    end

    should 'typograf article’s content with default options' do
      assert_equal '<p>Yes, this is an «Article»…</p>', @article.content
    end

    should 'typograf article’s title with custom options' do
      assert_equal '— Does it «Article»?', @article.title
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
als_typograf-0.0.5 test/unit/article_test.rb