fix tests
This commit is contained in:
3
Gemfile
3
Gemfile
@@ -19,7 +19,6 @@ gem "pg", "0.12.2"
|
||||
gem "memcache-client", :require => "memcache"
|
||||
gem "delayed_job"
|
||||
gem "delayed_job_active_record"
|
||||
gem "super_exception_notifier"
|
||||
gem "simple_form"
|
||||
gem "mechanize", :git => 'git://github.com/caribio/mechanize.git'
|
||||
gem "nokogiri"
|
||||
@@ -34,9 +33,9 @@ gem 'term-ansicolor', :require => "term/ansicolor"
|
||||
gem 'diff-lcs', :require => "diff/lcs/array"
|
||||
gem 'bcrypt-ruby', :require => "bcrypt"
|
||||
gem 'aws-s3', :require => "aws/s3"
|
||||
gem 'awesome_print'
|
||||
|
||||
group :development do
|
||||
gem 'ruby-prof'
|
||||
gem 'pry'
|
||||
gem 'awesome_print'
|
||||
end
|
||||
|
||||
@@ -162,9 +162,6 @@ GEM
|
||||
multi_json (~> 1.0)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
super_exception_notifier (3.0.13)
|
||||
actionmailer
|
||||
rake
|
||||
term-ansicolor (1.0.7)
|
||||
therubyracer (0.11.3)
|
||||
libv8 (~> 3.11.8.12)
|
||||
@@ -217,7 +214,6 @@ DEPENDENCIES
|
||||
shoulda
|
||||
simple_form
|
||||
simplecov
|
||||
super_exception_notifier
|
||||
term-ansicolor
|
||||
therubyracer
|
||||
uglifier (>= 1.0.3)
|
||||
|
||||
@@ -178,6 +178,8 @@ class Upload < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def add_dimension_tags!
|
||||
return if !Danbooru.config.enable_dimension_autotagging
|
||||
|
||||
if image_width >= 10_000 || image_height >= 10_000
|
||||
self.tag_string = "#{tag_string} incredibly_absurdres".strip
|
||||
elsif image_width >= 3200 || image_height >= 2400
|
||||
|
||||
@@ -297,5 +297,9 @@ module Danbooru
|
||||
# {:smtp_server_name => "smtp server", :user_name => "user name", :ses_smtp_user_name => "smtp user name", :ses_smtp_password => "smtp password"}
|
||||
nil
|
||||
end
|
||||
|
||||
def enable_dimension_autotagging
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ class TagAliasCorrectionTest < ActiveSupport::TestCase
|
||||
|
||||
should "have the correct statistics hash" do
|
||||
assert_equal("zzz", @correction.statistics_hash["antecedent_cache"])
|
||||
assert_nil(@correction.statistics_hash["consequent_cache"])
|
||||
assert_equal("bbb", @correction.statistics_hash["consequent_cache"])
|
||||
assert_equal(-3, @correction.statistics_hash["antecedent_count"])
|
||||
assert_equal(1, @correction.statistics_hash["consequent_count"])
|
||||
end
|
||||
|
||||
@@ -23,7 +23,7 @@ class UploadTest < ActiveSupport::TestCase
|
||||
FileUtils.rm_f(Dir.glob("#{Rails.root}/tmp/test.*"))
|
||||
end
|
||||
|
||||
context "that has insanely absurd res dimensions" do
|
||||
context "that has incredibly absurd res dimensions" do
|
||||
setup do
|
||||
@upload = FactoryGirl.build(:jpg_upload, :tag_string => "")
|
||||
@upload.image_width = 10_000
|
||||
@@ -31,8 +31,8 @@ class UploadTest < ActiveSupport::TestCase
|
||||
@upload.add_dimension_tags!
|
||||
end
|
||||
|
||||
should "have the insanely_absurdres tag" do
|
||||
assert_match(/insanely_absurdres/, @upload.tag_string)
|
||||
should "have the incredibly_absurdres tag" do
|
||||
assert_match(/incredibly_absurdres/, @upload.tag_string)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -189,7 +189,7 @@ class UploadTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
post = Post.last
|
||||
assert_equal("foo hoge", post.tag_string)
|
||||
assert_equal("foo hoge lowres", post.tag_string)
|
||||
assert_equal("s", post.rating)
|
||||
assert_equal(@upload.uploader_id, post.uploader_id)
|
||||
assert_equal("127.0.0.1", post.uploader_ip_addr)
|
||||
@@ -216,7 +216,7 @@ class UploadTest < ActiveSupport::TestCase
|
||||
assert_nothing_raised {@upload.process!}
|
||||
end
|
||||
post = Post.last
|
||||
assert_equal("foo hoge", post.tag_string)
|
||||
assert_equal("foo hoge lowres", post.tag_string)
|
||||
assert_equal("s", post.rating)
|
||||
assert_equal(@upload.uploader_id, post.uploader_id)
|
||||
assert_equal("127.0.0.1", post.uploader_ip_addr)
|
||||
|
||||
Reference in New Issue
Block a user