From 28c3f8321ac1b215cdc8f85fd8bcb55f56dafe05 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Mon, 9 Oct 2017 13:23:45 -0700 Subject: [PATCH] add failing test for #3307 --- test/unit/post_test.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/unit/post_test.rb b/test/unit/post_test.rb index 419e2bd33..3734c5cf2 100644 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -734,6 +734,23 @@ class PostTest < ActiveSupport::TestCase end context "tagged with a metatag" do + context "for a cosplay tag" do + setup do + @post = FactoryGirl.create(:post, tag_string: "char:someone_(cosplay)") + @tags = @post.tag_array + end + + should "add the cosplay tag" do + assert(@tags.include?("cosplay")) + end + + should "create the tag" do + assert(Tag.where(name: "someone_(cosplay)").exists?, "expected 'someone_(cosplay)' tag to be created") + assert(Tag.where(name: "someone_(cosplay)", category: 4).exists?, "expected 'someone_(cosplay)' tag to be created as character") + assert(Tag.where(name: "someone", category: 4).exists?, "expected 'someone' tag to be created") + end + end + context "for a parent" do setup do @parent = FactoryGirl.create(:post)