Sha256: c208d172ca976bb841dcb6555b161634e1095757ba351db8f4b53e1436d7cf1d
Contents?: true
Size: 1.64 KB
Versions: 6
Compression:
Stored size: 1.64 KB
Contents
require File.dirname(__FILE__) + '/test_helper' class ActsAsTextileTest < ActsAsMarkupTestCase context 'acts_as_textile' do setup do @textile_text = "h2. Textile Test Text" class ::Post < ActiveRecord::Base acts_as_textile :body end @post = Post.create!(:title => 'Blah', :body => @textile_text) end should "have a RedCloth object returned for the column value" do assert_kind_of RedCloth::TextileDoc, @post.body end should "return original textile text for a `to_s` method call on the column value" do assert_equal @textile_text, @post.body.to_s end should 'return false for .blank?' do assert !@post.body.blank? end should "return formated html for a `to_html` method call on the column value" do assert_match(/<h2>Textile Test Text<\/h2>/, @post.body.to_html) end context "changing value of textile field should return new textile object" do setup do @old_body = @post.body @post.body = "@@count = 20@" end should "still have an RedCloth object but not the same object" do assert_kind_of RedCloth::TextileDoc, @post.body assert_not_same @post.body, @old_body end should "return correct text for `to_s`" do assert_equal "@@count = 20@", @post.body.to_s end should "return correct HTML for the `to_html` method" do assert_match(/<code>\@count\s\=\s20<\/code>/, @post.body.to_html) end teardown do @old_body = nil end end teardown do @textile_text, @post = nil Post.delete_all end end end
Version data entries
6 entries across 6 versions & 2 rubygems