Sha256: 74c4bcb78cf953231bff7cb3d4cb5cc6c628858001e97c0c67261fb3dc0da155
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
require_relative 'helper' describe 'Adapter' do supported_by Swift::DB::Postgres, Swift::DB::Mysql do describe 'typecasting' do before do @db = Swift.db @db.execute %q{drop table if exists users} @db.execute %q{ create table users(id serial, name text, age integer, height float, hacker bool, slacker bool, created date) } end it 'query result is typecast correctly' do bind = [ 'jim', 32, 178.71, true, false ] @db.execute %q{insert into users(name,age,height,hacker,slacker, created) values(?, ?, ?, ?, ?, now())}, *bind result = @db.prepare(%q{select * from users limit 1}).execute.first assert_kind_of Integer, result[:id] assert_kind_of String, result[:name] assert_kind_of Integer, result[:age] assert_kind_of Float, result[:height] assert_kind_of TrueClass, result[:hacker] assert_kind_of FalseClass, result[:slacker] assert_kind_of Date, result[:created] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
swift-0.6.1 | test/test_types.rb |
swift-0.6.0 | test/test_types.rb |