Sha256: eccced87608dcd12c24506334be1c0939ea2f8ddda36b4155c07eeebec43890f

Contents?: true

Size: 1.55 KB

Versions: 30

Compression:

Stored size: 1.55 KB

Contents

require '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

30 entries across 30 versions & 1 rubygems

Version Path
request-log-analyzer-1.13.1 spec/unit/database/connection_spec.rb
request-log-analyzer-1.13.0 spec/unit/database/connection_spec.rb
request-log-analyzer-1.12.11 spec/unit/database/connection_spec.rb
request-log-analyzer-1.12.10 spec/unit/database/connection_spec.rb
request-log-analyzer-1.12.9 spec/unit/database/connection_spec.rb
request-log-analyzer-1.12.8 spec/unit/database/connection_spec.rb
request-log-analyzer-1.12.7 spec/unit/database/connection_spec.rb
request-log-analyzer-1.12.6 spec/unit/database/connection_spec.rb
request-log-analyzer-1.12.5 spec/unit/database/connection_spec.rb
request-log-analyzer-1.12.4 spec/unit/database/connection_spec.rb
request-log-analyzer-1.12.3 spec/unit/database/connection_spec.rb
request-log-analyzer-1.12.2 spec/unit/database/connection_spec.rb
request-log-analyzer-1.12.1 spec/unit/database/connection_spec.rb
request-log-analyzer-1.12.0 spec/unit/database/connection_spec.rb
request-log-analyzer-1.11.1 spec/unit/database/connection_spec.rb
request-log-analyzer-1.11.0 spec/unit/database/connection_spec.rb
request-log-analyzer-1.10.1 spec/unit/database/connection_spec.rb
request-log-analyzer-1.10.0 spec/unit/database/connection_spec.rb
request-log-analyzer-1.9.10 spec/unit/database/connection_spec.rb
request-log-analyzer-1.9.9 spec/unit/database/connection_spec.rb