addresses #2674: aliases+updates should migrate saved searches

This commit is contained in:
r888888888
2016-09-14 18:48:45 -07:00
parent 5555151ddd
commit ab6b5e49fe
4 changed files with 35 additions and 2 deletions

View File

@@ -16,14 +16,22 @@ module Moderator
end
should "execute" do
tag_batch_change = TagBatchChange.new("aaa", "bbb", @user, "127.0.0.1")
tag_batch_change = TagBatchChange.new("aaa", "bbb", @user.id, "127.0.0.1")
tag_batch_change.perform
@post.reload
assert_equal("bbb", @post.tag_string)
end
should "move saved searches" do
ss = FactoryGirl.create(:saved_search, :user => @user, :tag_query => "123 ... 456")
tag_batch_change = TagBatchChange.new("...", "bbb", @user.id, "127.0.0.1")
tag_batch_change.perform
ss.reload
assert_equal("123 bbb 456", ss.tag_query)
end
should "raise an error if there is no predicate" do
tag_batch_change = TagBatchChange.new("", "bbb", @user, "127.0.0.1")
tag_batch_change = TagBatchChange.new("", "bbb", @user.id, "127.0.0.1")
assert_raises(TagBatchChange::Error) do
tag_batch_change.perform
end