2017-08-12 08:32:15 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-07-09 12:31:27 -04:00
|
|
|
require "service/shared_service_tests"
|
|
|
|
|
|
|
|
class ActiveStorage::Service::ConfiguratorTest < ActiveSupport::TestCase
|
|
|
|
test "builds correct service instance based on service name" do
|
2017-07-09 16:21:14 -04:00
|
|
|
service = ActiveStorage::Service::Configurator.build(:foo, foo: { service: "Disk", root: "path" })
|
|
|
|
assert_instance_of ActiveStorage::Service::DiskService, service
|
2017-07-09 12:31:27 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
test "raises error when passing non-existent service name" do
|
|
|
|
assert_raise RuntimeError do
|
2017-07-09 16:21:14 -04:00
|
|
|
ActiveStorage::Service::Configurator.build(:bigfoot, {})
|
2017-07-09 12:31:27 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|