Sha256: 4d2f7b2e0f24dfef14c10e384b6a6f1f2aca2e29ca512034a29600403bd594f4

Contents?: true

Size: 630 Bytes

Versions: 1

Compression:

Stored size: 630 Bytes

Contents

shared 'raising a SQLError' do

  setup_test_environment

  before do
    @connection     = DataObjects::Connection.new(CONFIG.uri)
    @invalid_query  = @connection.create_command("SLCT * FROM widgets WHERE ad_description = ? order by id")
    @invalid_result = @connection.create_command("SELECT MAX((SELECT 1 UNION SELECT 2))")
  end

  it 'should raise an error on an invalid query' do
    should.raise(DataObjects::SQLError) { @invalid_query.execute_reader('Buy this product now!') }
  end

  it 'should raise on an invalid result set' do
    should.raise(DataObjects::SQLError) { @invalid_result.execute_reader }
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
data_objects-0.10.3 lib/data_objects/spec/error/sql_error_spec.rb