Add Docker and Travis config files to enable CI tests

Also fixes some Rails 6.0 deprecation warnings
This commit is contained in:
Albert Yi
2018-05-01 15:24:24 -07:00
parent fee9acc8a7
commit 79ea6f7e6c
18 changed files with 138 additions and 58 deletions

View File

@@ -58,6 +58,7 @@ class ActiveSupport::TestCase
include TestHelpers
setup do
Socket.stubs(:gethostname).returns("www.example.com")
mock_popular_search_service!
mock_missed_search_service!
WebMock.allow_net_connect!
@@ -104,6 +105,7 @@ class ActionDispatch::IntegrationTest
def setup
super
Socket.stubs(:gethostname).returns("www.example.com")
Danbooru.config.stubs(:enable_sock_puppet_validation?).returns(false)
end

View File

@@ -96,17 +96,17 @@ class UploadTest < ActiveSupport::TestCase
context "determining if a file is downloadable" do
should "classify HTTP sources as downloadable" do
@upload = FactoryBot.create(:source_upload, :source => "http://www.example.com/1.jpg")
@upload = FactoryBot.create(:source_upload, :source => "http://www.google.com/1.jpg")
assert_not_nil(@upload.is_downloadable?)
end
should "classify HTTPS sources as downloadable" do
@upload = FactoryBot.create(:source_upload, :source => "https://www.example.com/1.jpg")
@upload = FactoryBot.create(:source_upload, :source => "https://www.google.com/1.jpg")
assert_not_nil(@upload.is_downloadable?)
end
should "classify non-HTTP/HTTPS sources as not downloadable" do
@upload = FactoryBot.create(:source_upload, :source => "ftp://www.example.com/1.jpg")
@upload = FactoryBot.create(:source_upload, :source => "ftp://www.google.com/1.jpg")
assert_nil(@upload.is_downloadable?)
end
end