diff --git a/test/models/tag_autocomplete_test.rb b/test/models/tag_autocomplete_test.rb index fea1f7ed5..7a5db933c 100644 --- a/test/models/tag_autocomplete_test.rb +++ b/test/models/tag_autocomplete_test.rb @@ -31,12 +31,14 @@ class TagAutocompleteTest < ActiveSupport::TestCase context "#search_fuzzy" do setup do + CurrentUser.stubs(:id).returns(1) + @tags = [ - create(:tag, name: "abcdef", post_count: 1), - create(:tag, name: "abcdzz", post_count: 2), + create(:tag, name: "abcde", post_count: 1), + create(:tag, name: "abcdz", post_count: 2), # one char mismatch - create(:tag, name: "abcezz", post_count: 2), + create(:tag, name: "abcez", post_count: 2), # too long create(:tag, name: "abcdefghijk", post_count: 2), @@ -45,18 +47,18 @@ class TagAutocompleteTest < ActiveSupport::TestCase create(:tag, name: "bbcdef", post_count: 2), # zero post count - create(:tag, name: "abcdyy", post_count: 0), + create(:tag, name: "abcdy", post_count: 0), # completely different - create(:tag, name: "bbbbbb") + create(:tag, name: "bbbbb") ] end should "find the tags" do expected = [ + @tags[0], @tags[1], - @tags[2], - @tags[0] + @tags[2] ].map(&:name) assert_equal(expected, subject.search_fuzzy("abcd", 3).map(&:name)) end diff --git a/test/unit/artist_test.rb b/test/unit/artist_test.rb index a602e80c8..04e479a5c 100644 --- a/test/unit/artist_test.rb +++ b/test/unit/artist_test.rb @@ -280,9 +280,7 @@ class ArtistTest < ActiveSupport::TestCase end should "find nothing for bad IDs" do - assert_raises(PixivApiClient::BadIDError) do - assert_artist_not_found("http://www.pixiv.net/member_illust.php?mode=medium&illust_id=32049358") - end + assert_artist_not_found("http://www.pixiv.net/member_illust.php?mode=medium&illust_id=32049358") end end