Sha256: 7ab7eb05fd7e258be67bef5962926ab64a6e048b4cac7623101d1568a19bdbb7
Contents?: true
Size: 1.83 KB
Versions: 2
Compression:
Stored size: 1.83 KB
Contents
share_examples_for 'supporting Integer' 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 an Integer' do describe 'with automatic typecasting' do before do @reader = @connection.create_command("SELECT id 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(Integer) end it 'should return the correct result' do #Some of the drivers starts autoincrementation from 0 not 1 @values.first.should satisfy { |val| val == 1 or val == 0 } end end describe 'with manual typecasting' do before do @command = @connection.create_command("SELECT weight FROM widgets WHERE ad_description = ?") @command.set_types(Integer) @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(Integer) end it 'should return the correct result' do @values.first.should == 13 end end end describe 'writing an Integer' 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 @values.first.should == 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/integer_spec.rb |
data_objects-0.9.12 | lib/data_objects/spec/typecast/integer_spec.rb |