From 8ec96f42f73148f36fcf5906c40849c29a8c0574 Mon Sep 17 00:00:00 2001 From: Albert Yi Date: Tue, 4 Sep 2018 13:37:50 -0700 Subject: [PATCH] fix specs --- app/logical/sources/strategies/pixiv.rb | 4 ++-- app/logical/tag_autocomplete.rb | 2 +- app/models/tag_implication.rb | 1 - test/unit/post_test.rb | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/logical/sources/strategies/pixiv.rb b/app/logical/sources/strategies/pixiv.rb index 82e827f78..2da895c19 100644 --- a/app/logical/sources/strategies/pixiv.rb +++ b/app/logical/sources/strategies/pixiv.rb @@ -127,7 +127,7 @@ module Sources end def normalizable_for_artist_finder? - illust_id.present? || novel_id.present? || fanbox_id.present? + illust_id.present? || novel_id.present? || fanbox_id.present? || fanbox_account_id.present? end def unique_id @@ -219,7 +219,7 @@ module Sources end end - raise Sources::Error.new("Couldn't get illust ID from URL (#{url}, #{referer_url})") + return nil end memoize :illust_id diff --git a/app/logical/tag_autocomplete.rb b/app/logical/tag_autocomplete.rb index e3f645ce4..c7c34f127 100644 --- a/app/logical/tag_autocomplete.rb +++ b/app/logical/tag_autocomplete.rb @@ -18,7 +18,7 @@ module TagAutocomplete search_exact(query, 3) + search_prefix(query, 3) + search_fuzzy(query, 3) + - search_aliases(query, 10) + search_aliases(query, 3) ) end diff --git a/app/models/tag_implication.rb b/app/models/tag_implication.rb index 2425a89fd..3a9dd506f 100644 --- a/app/models/tag_implication.rb +++ b/app/models/tag_implication.rb @@ -12,7 +12,6 @@ class TagImplication < TagRelationship validate :consequent_is_not_aliased validate :antecedent_and_consequent_are_different validate :wiki_pages_present, :on => :create - scope :expired, ->{where("created_at < ?", 2.months.ago)} scope :old, ->{where("created_at between ? and ?", 2.months.ago, 1.month.ago)} scope :pending, ->{where(status: "pending")} diff --git a/test/unit/post_test.rb b/test/unit/post_test.rb index e105ea7f8..d2bdadc3a 100644 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -1513,7 +1513,7 @@ class PostTest < ActiveSupport::TestCase should "normalize deviantart links" do @post.source = "http://fc06.deviantart.net/fs71/f/2013/295/d/7/you_are_already_dead__by_mar11co-d6rgm0e.jpg" - assert_equal("https://mar11co.deviantart.com/art/You-Are-Already-Dead-408921710", @post.normalized_source) + assert_equal("https://www.deviantart.com/mar11co/art/You-Are-Already-Dead-408921710", @post.normalized_source) @post.source = "http://fc00.deviantart.net/fs71/f/2013/337/3/5/35081351f62b432f84eaeddeb4693caf-d6wlrqs.jpg" assert_equal("https://deviantart.com/deviation/417560500", @post.normalized_source) end