File: other_spec.rb

package info (click to toggle)
ruby-dataobjects 0.10.16-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 596 kB
  • ctags: 210
  • sloc: ruby: 2,984; makefile: 4
file content (47 lines) | stat: -rw-r--r-- 856 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class ::CustomTextType

  def initialize(value)
    @value = value
  end

  def to_s
    @value.to_s
  end

end

shared_examples_for 'supporting other (unknown) type' do

  before :all do
    setup_test_environment
  end

  describe 'writing an object of unknown type' do

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

    after do
      @connection.close
    end

    before do
      @command = @connection.create_command("SELECT ad_description FROM widgets WHERE ad_description = ?")
      @command.set_types(::CustomTextType)
      @reader = @command.execute_reader('Buy this product now!')
      @reader.next!
      @values = @reader.values
    end

    after do
      @reader.close
    end

    it 'should return the correct entry' do
      expect(@values.first).to eq('Buy this product now!')
    end

  end

end