File: connection_spec.rb

package info (click to toggle)
ruby-dataobjects-sqlite3 0.10.17-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 332 kB
  • sloc: ansic: 991; ruby: 322; makefile: 4
file content (37 lines) | stat: -rw-r--r-- 981 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# encoding: utf-8

require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
require 'data_objects/spec/shared/connection_spec'

describe DataObjects::Sqlite3::Connection do

  before :all do
    @driver = CONFIG.scheme
    @user   = CONFIG.user
    @password = CONFIG.pass
    @host   = CONFIG.host
    @port   = CONFIG.port
    @database = CONFIG.database
  end

  it_should_behave_like 'a Connection'
  it_should_behave_like 'a Connection via JDNI' if JRUBY
  it_should_behave_like 'a Connection with JDBC URL support' if JRUBY

  unless JRUBY

    describe 'connecting with busy timeout' do

      it 'connects with a valid timeout' do
        expect(DataObjects::Connection.new("#{CONFIG.uri}?busy_timeout=200")).to_not be_nil
      end

      it 'raises an error when passed an invalid value' do
        expect(lambda { DataObjects::Connection.new("#{CONFIG.uri}?busy_timeout=stuff") }).
          to raise_error(ArgumentError)
      end

    end
  end

end