Sha256: 24e7a46cfcf80096c9e3fd06eab4d9846f11222d6888e4aa231eb5f24c904029

Contents?: true

Size: 1.84 KB

Versions: 10

Compression:

Stored size: 1.84 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))

describe DataObjects::URI do
  subject { described_class.parse(uri) }

  context 'parsing parts' do
    let(:uri) { 'mock://username:password@localhost:12345/path?encoding=utf8#fragment'  }

    its(:scheme)    { should == 'mock'      }
    its(:user)      { should == 'username'  }
    its(:password)  { should == 'password'  }
    its(:host)      { should == 'localhost' }
    its(:port)      { should == 12345       }
    its(:path)      { should == '/path'     }
    its(:query)     { should == { 'encoding' => 'utf8' } }
    its(:fragment)  { should == 'fragment'  }

    it 'should provide a correct string representation' do
      subject.to_s.should == 'mock://username@localhost:12345/path?encoding=utf8#fragment'
    end
  end

  context 'parsing JDBC URL parts' do
    let(:uri) { 'jdbc:mock://username:password@localhost:12345/path?encoding=utf8#fragment'  }

    its(:scheme)    { should == 'jdbc'      }
    its(:subscheme) { should == 'mock'      }
    its(:user)      { should == 'username'  }
    its(:password)  { should == 'password'  }
    its(:host)      { should == 'localhost' }
    its(:port)      { should == 12345       }
    its(:path)      { should == '/path'     }
    its(:query)     { should == { 'encoding' => 'utf8' } }
    its(:fragment)  { should == 'fragment'  }

    it 'should provide a correct string representation' do
      subject.to_s.should == 'jdbc:mock://username@localhost:12345/path?encoding=utf8#fragment'
    end
  end

  context 'parsing parts' do
    let(:uri) { 'java:comp/env/jdbc/TestDataSource'  }

    its(:scheme)    { should == 'java' }
    its(:path)      { should == 'comp/env/jdbc/TestDataSource'     }

    it 'should provide a correct string representation' do
      subject.to_s.should == 'java:comp/env/jdbc/TestDataSource'
    end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
data_objects-0.10.17 spec/uri_spec.rb
data_objects-0.10.16 spec/uri_spec.rb
data_objects-0.10.15 spec/uri_spec.rb
data_objects-0.10.14 spec/uri_spec.rb
data_objects-0.10.13 spec/uri_spec.rb
data_objects-0.10.12 spec/uri_spec.rb
data_objects-0.10.11 spec/uri_spec.rb
data_objects-0.10.10 spec/uri_spec.rb
data_objects-0.10.9 spec/uri_spec.rb
data_objects-0.10.8 spec/uri_spec.rb