Sha256: ecc6296f296174a7d5e17280153362ced3a72cf261f394152811d4efcb0824ad
Contents?: true
Size: 1.84 KB
Versions: 2
Compression:
Stored size: 1.84 KB
Contents
share_examples_for 'supporting String' do include DataObjectsSpecHelpers before :all do setup_test_environment end before :each do @connection = DataObjects::Connection.new(CONFIG.uri) end after :each do @connection.close end describe 'reading a String' do describe 'with automatic typecasting' do before do @reader = @connection.create_command("SELECT code FROM widgets WHERE ad_description = ?").execute_reader('Buy this product now!') @reader.next! @values = @reader.values end after do @reader.close end it 'should return the correctly typed result' do @values.first.should be_kind_of(String) end it 'should return the correct result' do @values.first.should == "W0000001" end end describe 'with manual typecasting' do before do @command = @connection.create_command("SELECT weight FROM widgets WHERE ad_description = ?") @command.set_types(String) @reader = @command.execute_reader('Buy this product now!') @reader.next! @values = @reader.values end after do @reader.close end it 'should return the correctly typed result' do @values.first.should be_kind_of(String) end it 'should return the correct result' do @values.first.should == "13.4" end end end describe 'writing a String' do before do @reader = @connection.create_command("SELECT id FROM widgets WHERE id = ?").execute_reader("2") @reader.next! @values = @reader.values end after do @reader.close end it 'should return the correct entry' do # Some of the drivers starts autoincrementation from 0 not 1 @values.first.should satisfy { |val| val == 1 or val == 2 } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
data_objects-0.10.0 | lib/data_objects/spec/typecast/string_spec.rb |
data_objects-0.9.12 | lib/data_objects/spec/typecast/string_spec.rb |