From 6fb3ac1536d60bc12cf531e83e4060fe1fdf3d87 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Tue, 16 Jan 2018 20:32:02 -0500 Subject: Provide a sensible default host --- activestorage/lib/active_storage/service/disk_service.rb | 2 +- activestorage/test/dummy/config/storage.yml | 1 - activestorage/test/service/configurator_test.rb | 2 +- activestorage/test/service/disk_service_test.rb | 2 +- activestorage/test/service/mirror_service_test.rb | 5 ++--- activestorage/test/test_helper.rb | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-) (limited to 'activestorage') 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") -- cgit v1.2.3