aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2018-01-16 20:32:02 -0500
committerGeorge Claghorn <george@basecamp.com>2018-01-16 20:32:02 -0500
commit6fb3ac1536d60bc12cf531e83e4060fe1fdf3d87 (patch)
treee7d5383d4cf8d6cc17c508732f0c56afcbdcaca2 /activestorage
parent4c0cb1c2c9269c74588da9f114f52ea3707ae8fb (diff)
downloadrails-6fb3ac1536d60bc12cf531e83e4060fe1fdf3d87.tar.gz
rails-6fb3ac1536d60bc12cf531e83e4060fe1fdf3d87.tar.bz2
rails-6fb3ac1536d60bc12cf531e83e4060fe1fdf3d87.zip
Provide a sensible default host
Diffstat (limited to 'activestorage')
-rw-r--r--activestorage/lib/active_storage/service/disk_service.rb2
-rw-r--r--activestorage/test/dummy/config/storage.yml1
-rw-r--r--activestorage/test/service/configurator_test.rb2
-rw-r--r--activestorage/test/service/disk_service_test.rb2
-rw-r--r--activestorage/test/service/mirror_service_test.rb5
-rw-r--r--activestorage/test/test_helper.rb2
6 files changed, 6 insertions, 8 deletions
diff --git a/activestorage/lib/active_storage/service/disk_service.rb b/activestorage/lib/active_storage/service/disk_service.rb
index 27769db584..d17eea9046 100644
--- a/activestorage/lib/active_storage/service/disk_service.rb
+++ b/activestorage/lib/active_storage/service/disk_service.rb
@@ -11,7 +11,7 @@ module ActiveStorage
class Service::DiskService < Service
attr_reader :root, :host
- def initialize(root:, host:)
+ def initialize(root:, host: "http://localhost:3000")
@root, @host = root, host
end
diff --git a/activestorage/test/dummy/config/storage.yml b/activestorage/test/dummy/config/storage.yml
index 2acc78dc4c..2c6762e0d6 100644
--- a/activestorage/test/dummy/config/storage.yml
+++ b/activestorage/test/dummy/config/storage.yml
@@ -1,4 +1,3 @@
local:
service: Disk
root: <%= Rails.root.join("storage") %>
- host: http://localhost:3000
diff --git a/activestorage/test/service/configurator_test.rb b/activestorage/test/service/configurator_test.rb
index 0a79b37aa4..fe8a637ad0 100644
--- a/activestorage/test/service/configurator_test.rb
+++ b/activestorage/test/service/configurator_test.rb
@@ -4,7 +4,7 @@ require "service/shared_service_tests"
class ActiveStorage::Service::ConfiguratorTest < ActiveSupport::TestCase
test "builds correct service instance based on service name" do
- service = ActiveStorage::Service::Configurator.build(:foo, foo: { service: "Disk", root: "path", host: "http://localhost:3000" })
+ service = ActiveStorage::Service::Configurator.build(:foo, foo: { service: "Disk", root: "path" })
assert_instance_of ActiveStorage::Service::DiskService, service
assert_equal "path", service.root
diff --git a/activestorage/test/service/disk_service_test.rb b/activestorage/test/service/disk_service_test.rb
index f0171f8999..4a6361b920 100644
--- a/activestorage/test/service/disk_service_test.rb
+++ b/activestorage/test/service/disk_service_test.rb
@@ -3,7 +3,7 @@
require "service/shared_service_tests"
class ActiveStorage::Service::DiskServiceTest < ActiveSupport::TestCase
- SERVICE = ActiveStorage::Service::DiskService.new(root: File.join(Dir.tmpdir, "active_storage"), host: "http://localhost:3000")
+ SERVICE = ActiveStorage::Service::DiskService.new(root: File.join(Dir.tmpdir, "active_storage"))
include ActiveStorage::Service::SharedServiceTests
diff --git a/activestorage/test/service/mirror_service_test.rb b/activestorage/test/service/mirror_service_test.rb
index 6b601f3b2b..08efb095bc 100644
--- a/activestorage/test/service/mirror_service_test.rb
+++ b/activestorage/test/service/mirror_service_test.rb
@@ -6,13 +6,12 @@ class ActiveStorage::Service::MirrorServiceTest < ActiveSupport::TestCase
mirror_config = (1..3).map do |i|
[ "mirror_#{i}",
service: "Disk",
- root: Dir.mktmpdir("active_storage_tests_mirror_#{i}"),
- host: "http://localhost:3000" ]
+ root: Dir.mktmpdir("active_storage_tests_mirror_#{i}") ]
end.to_h
config = mirror_config.merge \
mirror: { service: "Mirror", primary: "primary", mirrors: mirror_config.keys },
- primary: { service: "Disk", root: Dir.mktmpdir("active_storage_tests_primary"), host: "http://localhost:3000" }
+ primary: { service: "Disk", root: Dir.mktmpdir("active_storage_tests_primary") }
SERVICE = ActiveStorage::Service.configure :mirror, config
diff --git a/activestorage/test/test_helper.rb b/activestorage/test/test_helper.rb
index 51f8ebad18..98fa44a604 100644
--- a/activestorage/test/test_helper.rb
+++ b/activestorage/test/test_helper.rb
@@ -34,7 +34,7 @@ rescue Errno::ENOENT
end
require "tmpdir"
-ActiveStorage::Blob.service = ActiveStorage::Service::DiskService.new(root: Dir.mktmpdir("active_storage_tests"), host: "http://localhost:3000")
+ActiveStorage::Blob.service = ActiveStorage::Service::DiskService.new(root: Dir.mktmpdir("active_storage_tests"))
ActiveStorage.logger = ActiveSupport::Logger.new(nil)
ActiveStorage.verifier = ActiveSupport::MessageVerifier.new("Testing")