1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activestorage/test/service/configurator_test.rb

24 lines
896 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require "service/shared_service_tests"
class ActiveStorage::Service::ConfiguratorTest < ActiveSupport::TestCase
test "builds correct service instance based on service name" do
2018-01-16 20:32:02 -05:00
service = ActiveStorage::Service::Configurator.build(:foo, foo: { service: "Disk", root: "path" })
assert_instance_of ActiveStorage::Service::DiskService, service
2018-01-15 13:06:17 -05:00
assert_equal "path", service.root
end
test "builds correct service instance based on lowercase service name" do
service = ActiveStorage::Service::Configurator.build(:foo, foo: { service: "disk", root: "path" })
assert_instance_of ActiveStorage::Service::DiskService, service
assert_equal "path", service.root
end
test "raises error when passing non-existent service name" do
assert_raise RuntimeError do
ActiveStorage::Service::Configurator.build(:bigfoot, {})
end
end
end