refactored search

This commit is contained in:
albert
2013-01-10 17:45:52 -05:00
parent 13271e9bf5
commit 8749c43b3e
85 changed files with 946 additions and 304 deletions

View File

@@ -3,6 +3,7 @@ require 'test_helper'
class AdvertisementTest < ActiveSupport::TestCase
context "An advertisement" do
setup do
Danbooru.config.stubs(:advertisement_path).returns("/tmp")
@ad = FactoryGirl.create(:advertisement, :file => upload_jpeg("#{Rails.root}/test/files/test.jpg"))
end

View File

@@ -127,7 +127,7 @@ class ArtistTest < ActiveSupport::TestCase
yuu = FactoryGirl.create(:artist, :name => "yuu", :group_name => "cat_or_fish")
cat_or_fish.reload
assert_equal("yuu", cat_or_fish.member_names)
assert_not_nil(Artist.search(:group_name_contains => "cat_or_fish").first)
assert_not_nil(Artist.search(:name => "group:cat_or_fish").first)
end
should "have an associated wiki" do

View File

@@ -27,7 +27,7 @@ module Sources
first_tag = @site.tags.first
assert_equal(2, first_tag.size)
assert(first_tag[0] =~ /./)
assert(first_tag[1] =~ /tags\.php\?tag=/)
assert(first_tag[1] =~ /search\.php/)
end
should "convert a page into a json representation" do

View File

@@ -7,11 +7,13 @@ class UploadTest < ActiveSupport::TestCase
CurrentUser.user = user
CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
end
teardown do
CurrentUser.user = nil
CurrentUser.ip_addr = nil
Delayed::Worker.delay_jobs = true
@upload.delete_temp_file if @upload
end
@@ -122,7 +124,7 @@ class UploadTest < ActiveSupport::TestCase
assert(File.exists?(@upload.resized_file_path_for(Danbooru.config.small_image_width)))
assert_equal(6197, File.size(@upload.resized_file_path_for(Danbooru.config.small_image_width)))
assert(File.exists?(@upload.resized_file_path_for(Danbooru.config.large_image_width)))
assert_equal(117877, File.size(@upload.resized_file_path_for(Danbooru.config.large_image_width)))
assert_equal(108224, File.size(@upload.resized_file_path_for(Danbooru.config.large_image_width)))
end
end