fixes #749, fixes tag alias related regressions

This commit is contained in:
albert
2013-03-05 22:51:21 -05:00
parent 80f63cc587
commit e53d71b31b
5 changed files with 64 additions and 45 deletions

View File

@@ -13,6 +13,7 @@ class TagAliasTest < ActiveSupport::TestCase
end
teardown do
MEMCACHE.flush_all
CurrentUser.user = nil
CurrentUser.ip_addr = nil
end
@@ -28,7 +29,7 @@ class TagAliasTest < ActiveSupport::TestCase
assert_equal("zzz", @correction.statistics_hash["antecedent_cache"])
assert_nil(@correction.statistics_hash["consequent_cache"])
assert_equal(-3, @correction.statistics_hash["antecedent_count"])
assert_nil(@correction.statistics_hash["consequent_count"])
assert_equal(1, @correction.statistics_hash["consequent_count"])
end
should "render to json" do

View File

@@ -73,5 +73,13 @@ class TagAliasTest < ActiveSupport::TestCase
assert_not_equal(tag_alias.creator_id, post.uploader_id)
assert_equal(tag_alias.creator_id, post.versions.last.updater_id)
end
should "push the antecedent's category to the consequent" do
tag1 = FactoryGirl.create(:tag, :name => "aaa", :category => 1)
tag2 = FactoryGirl.create(:tag, :name => "bbb")
ta = FactoryGirl.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb")
tag2.reload
assert_equal(1, tag2.category)
end
end
end