Tag change notices

This adds a small notice at the bottom of post searches if a single tag search is the target of any tag change request.
This commit is contained in:
Albert Yi
2019-01-14 18:14:27 -08:00
parent 60f0aeeb99
commit 1550538dc1
10 changed files with 143 additions and 0 deletions

View File

@@ -35,6 +35,33 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
end
end
context "#update_notice" do
setup do
@mock_redis = MockRedis.new
@forum_topic = FactoryBot.create(:forum_topic)
TagChangeNoticeService.stubs(:redis_client).returns(@mock_redis)
end
should "update redis" do
@script = "create alias aaa -> 000\n" +
"create implication bbb -> 111\n" +
"remove alias ccc -> 222\n" +
"remove implication ddd -> 333\n" +
"mass update eee -> 444\n"
FactoryBot.create(:bulk_update_request, script: @script, forum_topic: @forum_topic)
assert_equal(@forum_topic.id.to_s, @mock_redis.get("tcn:aaa"))
assert_equal(@forum_topic.id.to_s, @mock_redis.get("tcn:000"))
assert_equal(@forum_topic.id.to_s, @mock_redis.get("tcn:bbb"))
assert_equal(@forum_topic.id.to_s, @mock_redis.get("tcn:111"))
assert_equal(@forum_topic.id.to_s, @mock_redis.get("tcn:ccc"))
assert_equal(@forum_topic.id.to_s, @mock_redis.get("tcn:222"))
assert_equal(@forum_topic.id.to_s, @mock_redis.get("tcn:ddd"))
assert_equal(@forum_topic.id.to_s, @mock_redis.get("tcn:333"))
assert_equal(@forum_topic.id.to_s, @mock_redis.get("tcn:eee"))
assert_equal(@forum_topic.id.to_s, @mock_redis.get("tcn:444"))
end
end
context "on approval" do
setup do
@script = %q(