update forum topic when alias/implication/update request is updated
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user