BURs: fix normalization of uppercase characters in scripts.
Only downcase tags in aliases, implications, and category change commands. Don't downcase mass update commands. Mass updates are potentially case sensitive (for example: `mass update source:imageboard -> source:Imageboard`).
This commit is contained in:
@@ -65,6 +65,16 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
|
||||
assert_equal(false, @bur.valid?)
|
||||
assert_equal(["Can't create alias bbb -> aaa (A tag alias for aaa already exists)"], @bur.errors.full_messages)
|
||||
end
|
||||
|
||||
should "be case-insensitive" do
|
||||
@bur = create(:bulk_update_request, script: "CREATE ALIAS AAA -> BBB")
|
||||
@bur.approve!(@admin)
|
||||
perform_enqueued_jobs
|
||||
|
||||
@alias = TagAlias.find_by(antecedent_name: "aaa", consequent_name: "bbb")
|
||||
assert_equal(true, @alias.present?)
|
||||
assert_equal(true, @alias.is_active?)
|
||||
end
|
||||
end
|
||||
|
||||
context "the create implication command" do
|
||||
@@ -161,6 +171,16 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
|
||||
should "update the tags" do
|
||||
assert_equal("bar", @post.reload.tag_string)
|
||||
end
|
||||
|
||||
should "be case-sensitive" do
|
||||
@post = create(:post, source: "imageboard")
|
||||
@bur = create(:bulk_update_request, script: "mass update source:imageboard -> source:Imageboard")
|
||||
|
||||
@bur.approve!(@admin)
|
||||
perform_enqueued_jobs
|
||||
|
||||
assert_equal("Imageboard", @post.reload.source)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -294,10 +314,6 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
|
||||
assert_equal("pending", @req.status)
|
||||
end
|
||||
|
||||
should "downcase the text" do
|
||||
assert_equal("create alias aaa -> bbb", @req.script)
|
||||
end
|
||||
|
||||
should "update the topic when processed" do
|
||||
assert_difference("ForumPost.count") do
|
||||
@req.approve!(@admin)
|
||||
|
||||
Reference in New Issue
Block a user