Sha256: 9d04f811f00a9af2b14809c289156580d456a2996f445b5eb11372f9e8f350a8
Contents?: true
Size: 1.96 KB
Versions: 2
Compression:
Stored size: 1.96 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper')) require 'data_objects/spec/shared/connection_spec' require 'cgi' describe DataObjects::Mysql::Connection do before :all do @driver = CONFIG.scheme @user = CONFIG.user @password = CONFIG.pass @host = CONFIG.host @port = CONFIG.port @database = CONFIG.database @ssl = CONFIG.ssl end it_behaves_like 'a Connection' it_behaves_like 'a Connection with authentication support' it_behaves_like 'a Connection allowing default database' it_behaves_like 'a Connection with SSL support' if DataObjectsSpecHelpers.test_environment_supports_ssl? describe 'connecting with SSL' do it 'raises an error when passed ssl=true' do expect { DataObjects::Connection.new("#{CONFIG.uri}?ssl=true") } .to raise_error(ArgumentError) end it 'raises an error when passed a nonexistent client certificate' do expect { DataObjects::Connection.new("#{CONFIG.uri}?ssl[client_cert]=nonexistent") } .to raise_error(ArgumentError) end it 'raises an error when passed a nonexistent client key' do expect { DataObjects::Connection.new("#{CONFIG.uri}?ssl[client_key]=nonexistent") } .to raise_error(ArgumentError) end it 'raises an error when passed a nonexistent ca certificate' do expect { DataObjects::Connection.new("#{CONFIG.uri}?ssl[ca_cert]=nonexistent") } .to raise_error(ArgumentError) end it 'connects with a specified SSL cipher' do expect(DataObjects::Connection.new("#{CONFIG.uri}?#{CONFIG.ssl}&ssl[cipher]=#{SSLHelpers::CONFIG.cipher}") .ssl_cipher).to eq SSLHelpers::CONFIG.cipher end it 'raises an error with an invalid SSL cipher' do expect { DataObjects::Connection.new("#{CONFIG.uri}?#{CONFIG.ssl}&ssl[cipher]=invalid") } .to raise_error end end end end # rubocop:enable Metrics/BlockLength
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sbf-do_mysql-0.11.0 | spec/connection_spec.rb |
sbf-do_mysql-0.10.17 | spec/connection_spec.rb |