update forum topic when alias/implication/update request is updated

This commit is contained in:
r888888888
2015-02-15 12:51:02 -08:00
parent b524c2dfba
commit 387dece55a
8 changed files with 142 additions and 4 deletions

View File

@@ -15,5 +15,27 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
BulkUpdateRequest.create(:title => "abc", :reason => "zzz", :script => "create alias aaa -> bbb")
end
end
context "with an associated forum topic" do
setup do
@admin = FactoryGirl.create(:admin_user)
@topic = FactoryGirl.create(:forum_topic)
@req = FactoryGirl.create(:bulk_update_request, :script => "create alias aaa -> bbb", :forum_topic => @topic)
end
should "update the topic when processed" do
assert_difference("ForumPost.count") do
CurrentUser.scoped(@admin, "127.0.0.1") do
@req.approve!
end
end
end
should "update the topic when rejected" do
assert_difference("ForumPost.count") do
@req.reject!
end
end
end
end
end

View File

@@ -91,5 +91,25 @@ class TagAliasTest < ActiveSupport::TestCase
tag2.reload
assert_equal(1, tag2.category)
end
context "with an associated forum topic" do
setup do
@admin = FactoryGirl.create(:admin_user)
@topic = FactoryGirl.create(:forum_topic)
@alias = FactoryGirl.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb", :forum_topic => @topic)
end
should "update the topic when processed" do
assert_difference("ForumPost.count") do
@alias.process!
end
end
should "update the topic when rejected" do
assert_difference("ForumPost.count") do
@alias.reject!
end
end
end
end
end

View File

@@ -151,5 +151,25 @@ class TagImplicationTest < ActiveSupport::TestCase
p1.reload
assert_equal("aaa bbb ccc xxx yyy", p1.tag_string)
end
context "with an associated forum topic" do
setup do
@admin = FactoryGirl.create(:admin_user)
@topic = FactoryGirl.create(:forum_topic)
@implication = FactoryGirl.create(:tag_implication, :antecedent_name => "aaa", :consequent_name => "bbb", :forum_topic => @topic)
end
should "update the topic when processed" do
assert_difference("ForumPost.count") do
@implication.process!
end
end
should "update the topic when rejected" do
assert_difference("ForumPost.count") do
@implication.reject!
end
end
end
end
end