tag unit test

This commit is contained in:
Albert Yi
2010-02-06 23:11:26 -05:00
parent 305f4d4607
commit 341a24e22e
8 changed files with 403 additions and 11 deletions

View File

@@ -57,6 +57,11 @@ module Danbooru
1024
end
# When calculating statistics based on the posts table, gather this many posts to sample from.
def post_sample_size
300
end
# List of memcached servers
def memcached_servers
%w(localhost:11211)
@@ -102,8 +107,40 @@ module Danbooru
5
end
# The name of the server the app is hosted on.
def server_host
Socket.gethostname
end
# Returns a hash mapping various tag categories to a numerical value.
# Be sure to update the reverse_tag_category_mapping also.
def tag_category_mapping
@tag_category_mapping ||= {
"general" => 0,
"gen" => 0,
"artist" => 1,
"art" => 1,
"copyright" => 3,
"copy" => 3,
"co" => 3,
"character" => 4,
"char" => 4,
"ch" => 4
}
end
# Returns a hash maping numerical category values to their
# string equivalent. Be sure to update the tag_category_mapping also.
def reverse_tag_category_mapping
@reverse_tag_category_mapping ||= {
0 => "General",
1 => "Artist",
3 => "Copyright",
4 => "Character"
}
end
end
end