Sha256: f50741968fac019f2565cc0d4768dd579ef623a0c380b8c36b9cbab8a08798f0

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

shared 'supporting Class' do

  setup_test_environment

  before do
    @connection = DataObjects::Connection.new(CONFIG.uri)
  end

  after do
    @connection.close
  end

  describe 'reading a Class' do

    describe 'with manual typecasting' do

      before do
        @command = @connection.create_command("SELECT whitepaper_text FROM widgets WHERE ad_description = ?")
        @command.set_types(Class)
        @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(Class)
      end

      it 'should return the correct result' do
        @values.first.should == String
      end

    end

  end

  describe 'writing a Class' do

    before do
      @reader = @connection.create_command("SELECT whitepaper_text FROM widgets WHERE whitepaper_text = ?").execute_reader(String)
      @reader.next!
      @values = @reader.values
    end

    after do
      @reader.close
    end

    it 'should return the correct entry' do
      @values.first.should == "String"
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
data_objects-0.10.3 lib/data_objects/spec/typecast/class_spec.rb
data_objects-0.10.2 lib/data_objects/spec/typecast/class_spec.rb
data_objects-0.10.1 lib/data_objects/spec/typecast/class_spec.rb