Sha256: 5939ade0841e07535dce22a0e897a727bf57f8e36f97685bb109858b23d5b03e

Contents?: true

Size: 1.58 KB

Versions: 17

Compression:

Stored size: 1.58 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

describe RequestLogAnalyzer::Database::Connection do
  describe '.from_string' do

    it "should parse a name-value based string" do
      string = 'adapter=sqlite3;database=filename.db'
      RequestLogAnalyzer::Database::Connection.from_string(string).should == {:adapter => 'sqlite3', :database => 'filename.db'}
    end

    it "should parse an URI-based string for SQLite3" do
      string = 'sqlite3://filename.db'
      RequestLogAnalyzer::Database::Connection.from_string(string).should == {:adapter => 'sqlite3', :database => 'filename.db'}
    end

    it "should parse an URI-based string for MySQL" do
      string = 'mysql://localhost.local/database'
      RequestLogAnalyzer::Database::Connection.from_string(string).should ==
              { :adapter => 'mysql', :database => 'database', :host => 'localhost.local' }
    end

    it "should parse an URI-based string for MySQL with only username" do
      string = 'mysql://username@localhost.local/database'
      RequestLogAnalyzer::Database::Connection.from_string(string).should ==
              { :adapter => 'mysql', :database => 'database', :host => 'localhost.local', :username => 'username' }
    end

    it "should parse an URI-based string for MySQL with username and password" do
      string = 'mysql://username:password@localhost.local/database'
      RequestLogAnalyzer::Database::Connection.from_string(string).should ==
              { :adapter => 'mysql', :database => 'database', :host => 'localhost.local', :username => 'username', :password => 'password' }
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
request-log-analyzer-1.8.0 spec/unit/database/connection_spec.rb
request-log-analyzer-1.7.0 spec/unit/database/connection_spec.rb
request-log-analyzer-1.6.4 spec/unit/database/connection_spec.rb
request-log-analyzer-1.6.3 spec/unit/database/connection_spec.rb
request-log-analyzer-1.6.2 spec/unit/database/connection_spec.rb
request-log-analyzer-1.6.1 spec/unit/database/connection_spec.rb
request-log-analyzer-1.6.0 spec/unit/database/connection_spec.rb
request-log-analyzer-1.5.4 spec/unit/database/connection_spec.rb
request-log-analyzer-1.5.3 spec/unit/database/connection_spec.rb
request-log-analyzer-1.5.2 spec/unit/database/connection_spec.rb
request-log-analyzer-1.5.1 spec/unit/database/connection_spec.rb
request-log-analyzer-1.5.0 spec/unit/database/connection_spec.rb
request-log-analyzer-1.4.2 spec/unit/database/connection_spec.rb
ngmoco-request-log-analyzer-1.4.2 spec/unit/database/connection_spec.rb
request-log-analyzer-1.4.1 spec/unit/database/connection_spec.rb
request-log-analyzer-1.4.0.1 spec/unit/database/connection_spec.rb
request-log-analyzer-1.4.0 spec/unit/database/connection_spec.rb