Sha256: c6a81156b94f53a3d644adced0e8ae858603bd0163ad8df3fa72bc5fc2a66641

Contents?: true

Size: 507 Bytes

Versions: 8

Compression:

Stored size: 507 Bytes

Contents

require 'singleton'

module Tests
  class DatabaseConfigurationRegistry
    include Singleton

    def initialize
      @registry = {}
    end

    def register(config_class)
      registry[config_class.name] = config_class
    end

    def get(name)
      registry.fetch(name) do
        raise KeyError, "No such adapter registered: #{name}"
      end
    end

    protected

    attr_reader :registry
  end
end

require_relative 'database_adapters/postgresql'
require_relative 'database_adapters/sqlite3'

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
shoulda-matchers-3.1.3 spec/support/tests/database_configuration_registry.rb
shoulda-matchers-4.0.0.rc1 spec/support/tests/database_configuration_registry.rb
shoulda-matchers-3.1.2 spec/support/tests/database_configuration_registry.rb
shoulda-matchers-3.1.1 spec/support/tests/database_configuration_registry.rb
shoulda-matchers-3.1.0 spec/support/tests/database_configuration_registry.rb
shoulda-matchers-3.0.1 spec/support/tests/database_configuration_registry.rb
shoulda-matchers-3.0.0 spec/support/tests/database_configuration_registry.rb
shoulda-matchers-3.0.0.rc1 spec/support/tests/database_configuration_registry.rb