Sha256: 52e6c5d020ff60df4bdd38ea80ee8e68c3418185268623c648960c10b1c99151

Contents?: true

Size: 717 Bytes

Versions: 7

Compression:

Stored size: 717 Bytes

Contents

require_relative 'helper'

describe 'Error' do
  supported_by Swift::DB::Postgres, Swift::DB::Mysql do
    describe 'prepare' do
      before do
        Swift.db do |db|
          db.execute %q{drop table if exists users}
          db.execute %q{create table users(id serial, name text, primary key(id))}
        end
      end

      it 'throws a runtime error on invalid sql' do
        assert_raises(SwiftRuntimeError) do
          Swift.db.prepare('garble garble garble')
        end
      end

      it 'throws a runtime error on invalid bind parameters' do
        assert_raises(SwiftRuntimeError) do
          Swift.db.prepare('select * from users where id > ?').execute
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
swift-0.7.2 test/test_error.rb
swift-0.7.1 test/test_error.rb
swift-0.7.0 test/test_error.rb
swift-0.6.1 test/test_error.rb
swift-0.6.0 test/test_error.rb
swift-0.5.1 test/test_error.rb
swift-0.5.0 test/test_error.rb