diff --git a/config/providers/persistence.rb b/config/providers/persistence.rb deleted file mode 100644 index 0e03cf0..0000000 --- a/config/providers/persistence.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -Hanami.app.register_provider :persistence, namespace: true do - prepare do - require "rom-changeset" - require "rom/core" - require "rom/sql" - - # TODO(Hanami): As part of built-in rom setup, configure ROM with app inflector - silence_warnings { ROM::Inflector = Hanami.app["inflector"] } - - rom_config = ROM::Configuration.new(:sql, target["settings"].database_url) - - rom_config.plugin(:sql, relations: :instrumentation) do |plugin_config| - plugin_config.notifications = target["notifications"] - end - - rom_config.plugin(:sql, relations: :auto_restrictions) - - register "config", rom_config - register "db", rom_config.gateways[:default].connection - end - - start do - rom_config = target["persistence.config"] - rom_config.auto_registration( - target.root.join("app"), - namespace: Hanami.app.namespace.to_s - ) - - register "rom", ROM.container(rom_config) - end - - stop do - target["persistence.rom"].disconnect - end - - define_method(:silence_warnings) do |&block| - orig_verbose = $VERBOSE - $VERBOSE = nil - result = block.call - $VERBOSE = orig_verbose - result - end -end diff --git a/spec/support/db.rb b/spec/support/db.rb index 234be96..7e6a7de 100644 --- a/spec/support/db.rb +++ b/spec/support/db.rb @@ -6,10 +6,6 @@ require_relative "db/database_cleaner" require_relative "db/factory" RSpec.configure do |config| - config.before :suite do - Hanami.app.start :persistence - end - config.include Test::DB::Helpers, :db config.include(Test::DB::FactoryHelper.new, factory: nil)