Sha256: 3d07f4f647b804853778c100f2f9a178f3bdb0c9c1d50ff86a3bbf76b2db8716

Contents?: true

Size: 844 Bytes

Versions: 5

Compression:

Stored size: 844 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'
require File.dirname(__FILE__) + '/../fixture_setup'

# store default so we can revert so that other tests use default option
default_suffix = AutoHtmlFor.auto_html_for_options[:htmlized_attribute_suffix]
AutoHtmlFor.auto_html_for_options[:htmlized_attribute_suffix] = '_htmlized'

class Article < ActiveRecord::Base
  auto_html_for :body do
    simple_format
  end
end

class AutoHtmlForTest < Test::Unit::TestCase
  include FixtureSetup

  def test_transform_after_save
    @article = Article.new(:body => 'Yo!')
    assert_equal '<p>Yo!</p>', @article.body_htmlized
    @article.save!
    assert_equal '<p>Yo!</p>', @article.body_htmlized
  end
end

# reverting to default so that other tests use default option
AutoHtmlFor.auto_html_for_options[:htmlized_attribute_suffix] = default_suffix

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
auto_html-1.3.4 test/functional/auto_html_for_options_test.rb
auto_html-1.3.3 test/functional/auto_html_for_options_test.rb
auto_html-1.3.2 test/functional/auto_html_for_options_test.rb
auto_html-1.3.1 test/functional/auto_html_for_options_test.rb
auto_html-1.3.0 test/functional/auto_html_for_options_test.rb