Sha256: bfa2f15fe5dd549d957ece602789f7da306c654f3d729445a1d7487a7fdb369c

Contents?: true

Size: 861 Bytes

Versions: 9

Compression:

Stored size: 861 Bytes

Contents

require File.expand_path('../../test_helper', __FILE__)
require File.expand_path('../../fixture_setup', __FILE__)

# 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 AutoHtmlForOptionsTest < 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

9 entries across 9 versions & 1 rubygems

Version Path
auto_html-1.5.1.1 test/functional/auto_html_for_options_test.rb
auto_html-1.5.1 test/functional/auto_html_for_options_test.rb
auto_html-1.5.0 test/functional/auto_html_for_options_test.rb
auto_html-1.4.2 test/functional/auto_html_for_options_test.rb
auto_html-1.4.1 test/functional/auto_html_for_options_test.rb
auto_html-1.4.0 test/functional/auto_html_for_options_test.rb
auto_html-1.3.7 test/functional/auto_html_for_options_test.rb
auto_html-1.3.6 test/functional/auto_html_for_options_test.rb
auto_html-1.3.5 test/functional/auto_html_for_options_test.rb