added tag alias unit test

This commit is contained in:
albert
2010-02-12 13:43:00 -05:00
parent d388b1b3bd
commit f0ed612042
8 changed files with 72 additions and 31 deletions

View File

@@ -83,9 +83,21 @@ class PostTest < ActiveSupport::TestCase
post1 = Factory.create(:post, :tag_string => "aaa bbb ccc")
post2 = Factory.create(:post, :tag_string => "bbb ccc ddd")
post3 = Factory.create(:post, :tag_string => "ccc ddd eee")
user = Factory.create(:user)
assert_equal(1, Tag.find_by_name("aaa").post_count)
assert_equal(2, Tag.find_by_name("bbb").post_count)
assert_equal(3, Tag.find_by_name("ccc").post_count)
post3.update_attributes(
:tag_string => "xxx",
:updater_id => user.id,
:updater_ip_addr => "127.0.0.1"
)
assert_equal(1, Tag.find_by_name("aaa").post_count)
assert_equal(2, Tag.find_by_name("bbb").post_count)
assert_equal(2, Tag.find_by_name("ccc").post_count)
assert_equal(1, Tag.find_by_name("ddd").post_count)
assert_equal(0, Tag.find_by_name("eee").post_count)
assert_equal(1, Tag.find_by_name("xxx").post_count)
end
should "be counted" do