aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/test/test_helper.rb
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2018-01-15 13:06:17 -0500
committerGitHub <noreply@github.com>2018-01-15 13:06:17 -0500
commitc2ba530c43244b5b60fd629f61cd8b44c43ecda9 (patch)
tree76c572f419a8e30b4ba2d2ae22570844ba28361e /activestorage/test/test_helper.rb
parentd8e7d6b03c50f4f01c333461c46666d8210e2c17 (diff)
downloadrails-c2ba530c43244b5b60fd629f61cd8b44c43ecda9.tar.gz
rails-c2ba530c43244b5b60fd629f61cd8b44c43ecda9.tar.bz2
rails-c2ba530c43244b5b60fd629f61cd8b44c43ecda9.zip
Extract content types from blob data
Diffstat (limited to 'activestorage/test/test_helper.rb')
-rw-r--r--activestorage/test/test_helper.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/activestorage/test/test_helper.rb b/activestorage/test/test_helper.rb
index aaf1d452ea..51f8ebad18 100644
--- a/activestorage/test/test_helper.rb
+++ b/activestorage/test/test_helper.rb
@@ -7,6 +7,7 @@ require "bundler/setup"
require "active_support"
require "active_support/test_case"
require "active_support/testing/autorun"
+require "webmock/minitest"
require "mini_magick"
begin
@@ -33,7 +34,7 @@ rescue Errno::ENOENT
end
require "tmpdir"
-ActiveStorage::Blob.service = ActiveStorage::Service::DiskService.new(root: Dir.mktmpdir("active_storage_tests"))
+ActiveStorage::Blob.service = ActiveStorage::Service::DiskService.new(root: Dir.mktmpdir("active_storage_tests"), host: "http://localhost:3000")
ActiveStorage.logger = ActiveSupport::Logger.new(nil)
ActiveStorage.verifier = ActiveSupport::MessageVerifier.new("Testing")
@@ -41,6 +42,8 @@ ActiveStorage.verifier = ActiveSupport::MessageVerifier.new("Testing")
class ActiveSupport::TestCase
self.file_fixture_path = File.expand_path("fixtures/files", __dir__)
+ setup { WebMock.allow_net_connect! }
+
private
def create_blob(data: "Hello world!", filename: "hello.txt", content_type: "text/plain")
ActiveStorage::Blob.create_after_upload! io: StringIO.new(data), filename: filename, content_type: content_type