Sha256: 5b11c658d9646987efaaf9011bb4bfdf7877b24a19a226faa66ee7a546d36221

Contents?: true

Size: 827 Bytes

Versions: 11

Compression:

Stored size: 827 Bytes

Contents

require "spec_helper"

describe "Simple::SQL::Config" do
  describe ".determine_url" do
    it "reads config/database.yml" do
      expect(SQL::Config.determine_url).to eq "postgres://postgres@127.0.0.1/simple-sql-test"
    end
  end

  describe ".parse_url" do
    it "parses a DATABASE_URL" do
      parsed = SQL::Config.parse_url "postgres://foo:bar@server/database"
      expect(parsed).to eq(
          dbname: "database",
          host: "server",
          password: "bar",
          sslmode: "prefer",
          user: "foo")
    end

    it "may enforce SSL" do
      parsed = SQL::Config.parse_url "postgress://foo:bar@server/database"
      expect(parsed).to eq(
          dbname: "database",
          host: "server",
          password: "bar",
          sslmode: "require",
          user: "foo")
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
simple-sql-0.3.5 spec/simple/sql_config_spec.rb
simple-sql-0.3.4 spec/simple/sql_config_spec.rb
simple-sql-0.3.3 spec/simple/sql_config_spec.rb
simple-sql-0.2.10 spec/simple/sql_config_spec.rb
simple-sql-0.3.2 spec/simple/sql_config_spec.rb
simple-sql-0.2.9 spec/simple/sql_config_spec.rb
simple-sql-0.3.1 spec/simple/sql_config_spec.rb
simple-sql-0.2.8 spec/simple/sql_config_spec.rb
simple-sql-0.3.0 spec/simple/sql_config_spec.rb
simple-sql-0.2.7 spec/simple/sql_config_spec.rb
simple-sql-0.2.6 spec/simple/sql_config_spec.rb