Sha256: 3d33fa291a3b0b54a8f18b4af991983b6a60201001168a0b3fabfd248300714f

Contents?: true

Size: 620 Bytes

Versions: 41

Compression:

Stored size: 620 Bytes

Contents

require 'yaml'
require 'erb'

module CompositePrimaryKeys
  class ConnectionSpec
    def self.[](adapter)
      config[adapter.to_s].dup
    end

    private

    def self.config
      @config ||= begin
        # Find the file location
        path = File.join(PROJECT_ROOT, 'test', 'connections', 'databases.yml')

        # Run any erb code
        template = ERB.new(File.read(path))
        project_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
        data = template.result(binding)

        # And now to YAML
        YAML.load(data)
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
composite_primary_keys-9.0.5 test/connections/connection_spec.rb