Sha256: aad465deee20e055c4b68b6ef3d677c26efc6a72bf4a5be39462aba1f143fe9e

Contents?: true

Size: 618 Bytes

Versions: 10

Compression:

Stored size: 618 Bytes

Contents

require 'yaml'

module Helpers

  def configs
    {
      db1: { adapter: "sqlite3", database: "tmp/db1.sqlite" },
      db2: { adapter: "sqlite3", database: "tmp/db2.sqlite" }
    }
  end

  def mysql2_configs
    YAML.load_file('spec/support/config.yml').with_indifferent_access
  end

  def db(connection)
    case connection
    when ActiveRecord::ConnectionAdapters::SQLite3Adapter
      connection.execute('PRAGMA database_list').first['file'].split('/').last.split('.').first
    when ActiveRecord::ConnectionAdapters::Mysql2Adapter
      connection.instance_variable_get(:@config)[:database]
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
octoshark-0.6.0 spec/support/helpers.rb
octoshark-0.5.1 spec/support/helpers.rb
octoshark-0.5.0 spec/support/helpers.rb
octoshark-0.4.0 spec/support/helpers.rb
octoshark-0.3.0 spec/support/helpers.rb
octoshark-0.2.2 spec/support/helpers.rb
octoshark-0.2.1 spec/support/helpers.rb
octoshark-0.2.0 spec/support/helpers.rb
octoshark-0.1.2 spec/support/helpers.rb
octoshark-0.1.1 spec/support/helpers.rb