Sha256: 066bfc368e640d9d00d3c273239c47b0f2d89074ff22106c224becb4ea5c37e3

Contents?: true

Size: 840 Bytes

Versions: 7

Compression:

Stored size: 840 Bytes

Contents

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

class Article < ActiveRecord::Base
  auto_html_for :body do
    html_escape
    youtube(:width => 400, :height => 250)
    image
    link(:target => "_blank", :rel => "nofollow")
    simple_format
  end
end

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

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

  def test_transform_after_update
    @article = Article.create!(:body => 'Yo!')
    @article.update_attributes(:body => 'http://vukajlija.com')
    @article.save!
    assert_equal '<p><a href="http://vukajlija.com" rel="nofollow" target="_blank">http://vukajlija.com</a></p>', @article.body_html
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
dejan-auto_html-1.1.0 test/functional/auto_html_for_test.rb
dejan-auto_html-1.1.1 test/functional/auto_html_for_test.rb
dejan-auto_html-1.1.2 test/functional/auto_html_for_test.rb
dejan-auto_html-1.2.0 test/functional/auto_html_for_test.rb
galetahub-auto_html-1.0.1 test/functional/auto_html_for_test.rb
auto_html-1.2.1 test/functional/auto_html_for_test.rb
auto_html-1.2.0 test/functional/auto_html_for_test.rb