From b66773086c0debe8985e919a4fcfc1c99befd894 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Mon, 9 Oct 2017 15:03:53 -0700 Subject: [PATCH] add failing test #3307 --- test/unit/post_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/unit/post_test.rb b/test/unit/post_test.rb index 3734c5cf2..f3581a776 100644 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -734,6 +734,24 @@ class PostTest < ActiveSupport::TestCase end context "tagged with a metatag" do + context "for an alias cosplay tag" do + setup do + @alias = FactoryGirl.create(:tag_alias, antecedent_name: "hoge", consequent_name: "moge") + @post = FactoryGirl.create(:post, tag_string: "char:hoge_(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 cosplay tag" do setup do @post = FactoryGirl.create(:post, tag_string: "char:someone_(cosplay)")