From 18720bc8fbf269184ac6f183a82ed045cc0c1965 Mon Sep 17 00:00:00 2001 From: Dino Maric Date: Sun, 9 Jul 2017 18:31:27 +0200 Subject: Add basic tests to the Configurator#build (#28) --- test/service/configurator_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/service/configurator_test.rb (limited to 'test/service') diff --git a/test/service/configurator_test.rb b/test/service/configurator_test.rb new file mode 100644 index 0000000000..f033fc7d20 --- /dev/null +++ b/test/service/configurator_test.rb @@ -0,0 +1,15 @@ +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(:s3, SERVICE_CONFIGURATIONS) + assert_instance_of ActiveStorage::Service::S3Service, service + end + + test "raises error when passing non-existent service name" do + assert_raise RuntimeError do + ActiveStorage::Service::Configurator.build(:bigfoot, SERVICE_CONFIGURATIONS) + end + end +end + -- cgit v1.2.3