data_objects 0.10.3 → 0.10.4.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/LICENSE +1 -1
  2. data/README.markdown +1 -1
  3. data/Rakefile +6 -32
  4. data/lib/data_objects/connection.rb +9 -6
  5. data/lib/data_objects/pooling.rb +1 -1
  6. data/lib/data_objects/spec/lib/pending_helpers.rb +11 -0
  7. data/lib/data_objects/spec/{helpers → lib}/ssl.rb +0 -0
  8. data/lib/data_objects/spec/setup.rb +5 -0
  9. data/lib/data_objects/spec/{command_spec.rb → shared/command_spec.rb} +54 -50
  10. data/lib/data_objects/spec/shared/connection_spec.rb +245 -0
  11. data/lib/data_objects/spec/{encoding_spec.rb → shared/encoding_spec.rb} +41 -43
  12. data/lib/data_objects/spec/shared/error/sql_error_spec.rb +30 -0
  13. data/lib/data_objects/spec/{quoting_spec.rb → shared/quoting_spec.rb} +0 -0
  14. data/lib/data_objects/spec/{reader_spec.rb → shared/reader_spec.rb} +31 -26
  15. data/lib/data_objects/spec/shared/result_spec.rb +79 -0
  16. data/lib/data_objects/spec/{typecast → shared/typecast}/array_spec.rb +4 -2
  17. data/lib/data_objects/spec/{typecast → shared/typecast}/bigdecimal_spec.rb +12 -8
  18. data/lib/data_objects/spec/{typecast → shared/typecast}/boolean_spec.rb +14 -10
  19. data/lib/data_objects/spec/{typecast → shared/typecast}/byte_array_spec.rb +6 -4
  20. data/lib/data_objects/spec/{typecast → shared/typecast}/class_spec.rb +5 -3
  21. data/lib/data_objects/spec/{typecast → shared/typecast}/date_spec.rb +13 -9
  22. data/lib/data_objects/spec/{typecast → shared/typecast}/datetime_spec.rb +14 -11
  23. data/lib/data_objects/spec/{typecast → shared/typecast}/float_spec.rb +17 -13
  24. data/lib/data_objects/spec/{typecast → shared/typecast}/integer_spec.rb +7 -5
  25. data/lib/data_objects/spec/{typecast → shared/typecast}/ipaddr_spec.rb +0 -0
  26. data/lib/data_objects/spec/{typecast → shared/typecast}/nil_spec.rb +23 -17
  27. data/lib/data_objects/spec/{typecast → shared/typecast}/other_spec.rb +11 -9
  28. data/lib/data_objects/spec/{typecast → shared/typecast}/range_spec.rb +4 -2
  29. data/lib/data_objects/spec/{typecast → shared/typecast}/string_spec.rb +10 -8
  30. data/lib/data_objects/spec/{typecast → shared/typecast}/time_spec.rb +44 -6
  31. data/lib/data_objects/transaction.rb +9 -0
  32. data/lib/data_objects/uri.rb +62 -4
  33. data/lib/data_objects/version.rb +1 -1
  34. data/spec/command_spec.rb +2 -2
  35. data/spec/connection_spec.rb +45 -25
  36. data/spec/pooling_spec.rb +9 -9
  37. data/spec/reader_spec.rb +11 -12
  38. data/spec/result_spec.rb +13 -11
  39. data/spec/spec_helper.rb +1 -16
  40. data/spec/transaction_spec.rb +9 -11
  41. data/spec/uri_spec.rb +35 -27
  42. data/tasks/spec.rake +8 -17
  43. metadata +40 -56
  44. data/lib/data_objects/spec/bacon.rb +0 -9
  45. data/lib/data_objects/spec/connection_spec.rb +0 -217
  46. data/lib/data_objects/spec/error/sql_error_spec.rb +0 -19
  47. data/lib/data_objects/spec/helpers/immediate_red_green_output.rb +0 -59
  48. data/lib/data_objects/spec/helpers/pending.rb +0 -22
  49. data/lib/data_objects/spec/result_spec.rb +0 -79
  50. data/tasks/metrics.rake +0 -36
@@ -1,6 +1,8 @@
1
- shared 'supporting BigDecimal' do
1
+ shared_examples_for 'supporting BigDecimal' do
2
2
 
3
- setup_test_environment
3
+ before :all do
4
+ setup_test_environment
5
+ end
4
6
 
5
7
  before do
6
8
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -27,7 +29,7 @@ shared 'supporting BigDecimal' do
27
29
  end
28
30
 
29
31
  it 'should return the correctly typed result' do
30
- @values.first.should.be.kind_of(BigDecimal)
32
+ @values.first.should be_kind_of(BigDecimal)
31
33
  end
32
34
 
33
35
  it 'should return the correct result' do
@@ -52,11 +54,11 @@ shared 'supporting BigDecimal' do
52
54
  end
53
55
 
54
56
  it 'should return the correctly typed result' do
55
- @values.first.should.be.kind_of(NilClass)
57
+ @values.first.should be_kind_of(NilClass)
56
58
  end
57
59
 
58
60
  it 'should return the correct result' do
59
- @values.first.should.be.nil
61
+ @values.first.should be_nil
60
62
  end
61
63
 
62
64
  end
@@ -83,9 +85,11 @@ shared 'supporting BigDecimal' do
83
85
 
84
86
  end
85
87
 
86
- shared 'supporting BigDecimal autocasting' do
88
+ shared_examples_for 'supporting BigDecimal autocasting' do
87
89
 
88
- setup_test_environment
90
+ before :all do
91
+ setup_test_environment
92
+ end
89
93
 
90
94
  before do
91
95
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -110,7 +114,7 @@ shared 'supporting BigDecimal autocasting' do
110
114
  end
111
115
 
112
116
  it 'should return the correctly typed result' do
113
- @values.first.should.be.kind_of(BigDecimal)
117
+ @values.first.should be_kind_of(BigDecimal)
114
118
  end
115
119
 
116
120
  it 'should return the correct result' do
@@ -1,6 +1,8 @@
1
- shared 'supporting Boolean' do
1
+ shared_examples_for 'supporting Boolean' do
2
2
 
3
- setup_test_environment
3
+ before :all do
4
+ setup_test_environment
5
+ end
4
6
 
5
7
  before do
6
8
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -27,7 +29,7 @@ shared 'supporting Boolean' do
27
29
  end
28
30
 
29
31
  it 'should return the correctly typed result' do
30
- @values.first.should.be.kind_of(FalseClass)
32
+ @values.first.should be_kind_of(FalseClass)
31
33
  end
32
34
 
33
35
  it 'should return the correct result' do
@@ -51,11 +53,11 @@ shared 'supporting Boolean' do
51
53
  end
52
54
 
53
55
  it 'should return the correctly typed result' do
54
- @values.first.should.be.kind_of(TrueClass)
56
+ @values.first.should be_kind_of(TrueClass)
55
57
  end
56
58
 
57
59
  it 'should return the correct result' do
58
- @values.first.should.be.true
60
+ @values.first.should be_true
59
61
  end
60
62
 
61
63
  end
@@ -75,11 +77,11 @@ shared 'supporting Boolean' do
75
77
  end
76
78
 
77
79
  it 'should return the correctly typed result' do
78
- @values.first.should.be.kind_of(NilClass)
80
+ @values.first.should be_kind_of(NilClass)
79
81
  end
80
82
 
81
83
  it 'should return the correct result' do
82
- @values.first.should.be.nil
84
+ @values.first.should be_nil
83
85
  end
84
86
 
85
87
  end
@@ -106,9 +108,11 @@ shared 'supporting Boolean' do
106
108
 
107
109
  end
108
110
 
109
- shared 'supporting Boolean autocasting' do
111
+ shared_examples_for 'supporting Boolean autocasting' do
110
112
 
111
- setup_test_environment
113
+ before :all do
114
+ setup_test_environment
115
+ end
112
116
 
113
117
  before do
114
118
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -133,7 +137,7 @@ shared 'supporting Boolean autocasting' do
133
137
  end
134
138
 
135
139
  it 'should return the correctly typed result' do
136
- @values.first.should.be.kind_of(FalseClass)
140
+ @values.first.should be_kind_of(FalseClass)
137
141
  end
138
142
 
139
143
  it 'should return the correct result' do
@@ -1,6 +1,8 @@
1
- shared 'supporting ByteArray' do
1
+ shared_examples_for 'supporting ByteArray' do
2
2
 
3
- setup_test_environment
3
+ before :all do
4
+ setup_test_environment
5
+ end
4
6
 
5
7
  before do
6
8
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -25,7 +27,7 @@ shared 'supporting ByteArray' do
25
27
  end
26
28
 
27
29
  it 'should return the correctly typed result' do
28
- @values.first.should.be.kind_of(::Extlib::ByteArray)
30
+ @values.first.should be_kind_of(::Extlib::ByteArray)
29
31
  end
30
32
 
31
33
  it 'should return the correct result' do
@@ -49,7 +51,7 @@ shared 'supporting ByteArray' do
49
51
  end
50
52
 
51
53
  it 'should return the correctly typed result' do
52
- @values.first.should.be.kind_of(::Extlib::ByteArray)
54
+ @values.first.should be_kind_of(::Extlib::ByteArray)
53
55
  end
54
56
 
55
57
  it 'should return the correct result' do
@@ -1,6 +1,8 @@
1
- shared 'supporting Class' do
1
+ shared_examples_for 'supporting Class' do
2
2
 
3
- setup_test_environment
3
+ before :all do
4
+ setup_test_environment
5
+ end
4
6
 
5
7
  before do
6
8
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -27,7 +29,7 @@ shared 'supporting Class' do
27
29
  end
28
30
 
29
31
  it 'should return the correctly typed result' do
30
- @values.first.should.be.kind_of(Class)
32
+ @values.first.should be_kind_of(Class)
31
33
  end
32
34
 
33
35
  it 'should return the correct result' do
@@ -1,6 +1,8 @@
1
- shared 'supporting Date' do
1
+ shared_examples_for 'supporting Date' do
2
2
 
3
- setup_test_environment
3
+ before :all do
4
+ setup_test_environment
5
+ end
4
6
 
5
7
  before do
6
8
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -27,7 +29,7 @@ shared 'supporting Date' do
27
29
  end
28
30
 
29
31
  it 'should return the correctly typed result' do
30
- @values.first.should.be.kind_of(Date)
32
+ @values.first.should be_kind_of(Date)
31
33
  end
32
34
 
33
35
  it 'should return the correct result' do
@@ -51,11 +53,11 @@ shared 'supporting Date' do
51
53
  end
52
54
 
53
55
  it 'should return a nil class' do
54
- @values.first.should.be.kind_of(NilClass)
56
+ @values.first.should be_kind_of(NilClass)
55
57
  end
56
58
 
57
59
  it 'should return nil' do
58
- @values.first.should.be.nil
60
+ @values.first.should be_nil
59
61
  end
60
62
 
61
63
  end
@@ -76,16 +78,18 @@ shared 'supporting Date' do
76
78
 
77
79
  it 'should return the correct entry' do
78
80
  #Some of the drivers starts autoincrementation from 0 not 1
79
- @values.first.should.satisfy { |val| val == 1 or val == 0 }
81
+ @values.first.should satisfy { |val| val == 1 or val == 0 }
80
82
  end
81
83
 
82
84
  end
83
85
 
84
86
  end
85
87
 
86
- shared 'supporting Date autocasting' do
88
+ shared_examples_for 'supporting Date autocasting' do
87
89
 
88
- setup_test_environment
90
+ before :all do
91
+ setup_test_environment
92
+ end
89
93
 
90
94
  before do
91
95
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -110,7 +114,7 @@ shared 'supporting Date autocasting' do
110
114
  end
111
115
 
112
116
  it 'should return the correctly typed result' do
113
- @values.first.should.be.kind_of(Date)
117
+ @values.first.should be_kind_of(Date)
114
118
  end
115
119
 
116
120
  it 'should return the correct result' do
@@ -1,8 +1,10 @@
1
1
  JRUBY = RUBY_PLATFORM =~ /java/ unless defined?(JRUBY)
2
2
 
3
- shared 'supporting DateTime' do
3
+ shared_examples_for 'supporting DateTime' do
4
4
 
5
- setup_test_environment
5
+ before :all do
6
+ setup_test_environment
7
+ end
6
8
 
7
9
  before do
8
10
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -29,7 +31,7 @@ shared 'supporting DateTime' do
29
31
  end
30
32
 
31
33
  it 'should return the correctly typed result' do
32
- @values.first.should.be.kind_of(DateTime)
34
+ @values.first.should be_kind_of(DateTime)
33
35
  end
34
36
 
35
37
  it 'should return the correct result' do
@@ -54,11 +56,11 @@ shared 'supporting DateTime' do
54
56
  end
55
57
 
56
58
  it 'should return a nil class' do
57
- @values.first.should.be.kind_of(NilClass)
59
+ @values.first.should be_kind_of(NilClass)
58
60
  end
59
61
 
60
62
  it 'should return nil' do
61
- @values.first.should.be.nil
63
+ @values.first.should be_nil
62
64
  end
63
65
 
64
66
  end
@@ -106,16 +108,18 @@ shared 'supporting DateTime' do
106
108
 
107
109
  it 'should return the correct entry' do
108
110
  #Some of the drivers starts autoincrementation from 0 not 1
109
- @values.first.should.satisfy { |val| val == 0 or val == 1 }
111
+ @values.first.should satisfy { |val| val == 0 or val == 1 }
110
112
  end
111
113
 
112
114
  end
113
115
 
114
116
  end
115
117
 
116
- shared 'supporting DateTime autocasting' do
118
+ shared_examples_for 'supporting DateTime autocasting' do
117
119
 
118
- setup_test_environment
120
+ before :all do
121
+ setup_test_environment
122
+ end
119
123
 
120
124
  before do
121
125
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -140,12 +144,11 @@ shared 'supporting DateTime autocasting' do
140
144
  end
141
145
 
142
146
  it 'should return the correctly typed result' do
143
- @values.first.should.be.kind_of(DateTime)
147
+ @values.first.should be_kind_of(DateTime)
144
148
  end
145
149
 
146
150
  it 'should return the correct result' do
147
- pending('when this is fixed for DST issues')
148
- @values.first.should == Time.local(2008, 2, 14, 00, 31, 12).to_datetime
151
+ @values.first.should == Time.local(2008, 2, 14, 00, 31, 12).send(:to_datetime)
149
152
  end
150
153
 
151
154
  end
@@ -1,6 +1,8 @@
1
- shared 'supporting Float' do
1
+ shared_examples_for 'supporting Float' do
2
2
 
3
- setup_test_environment
3
+ before :all do
4
+ setup_test_environment
5
+ end
4
6
 
5
7
  before do
6
8
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -27,12 +29,12 @@ shared 'supporting Float' do
27
29
  end
28
30
 
29
31
  it 'should return the correctly typed result' do
30
- @values.first.should.be.kind_of(Float)
32
+ @values.first.should be_kind_of(Float)
31
33
  end
32
34
 
33
35
  it 'should return the correct result' do
34
36
  #Some of the drivers starts autoincrementation from 0 not 1
35
- @values.first.should.satisfy { |val| val == 1.0 or val == 0.0 }
37
+ @values.first.should satisfy { |val| val == 1.0 or val == 0.0 }
36
38
  end
37
39
 
38
40
  end
@@ -52,17 +54,17 @@ shared 'supporting Float' do
52
54
  end
53
55
 
54
56
  it 'should return the correctly typed result' do
55
- @values.first.should.be.kind_of(NilClass)
57
+ @values.first.should be_kind_of(NilClass)
56
58
  end
57
59
 
58
60
  it 'should return the correct result' do
59
- @values.first.should.be.nil
61
+ @values.first.should be_nil
60
62
  end
61
63
 
62
64
  end
63
65
  end
64
66
 
65
- describe 'writing an Float' do
67
+ describe 'writing a Float' do
66
68
 
67
69
  before do
68
70
  @reader = @connection.create_command("SELECT id FROM widgets WHERE id = ?").execute_reader(2.0)
@@ -75,17 +77,19 @@ shared 'supporting Float' do
75
77
  end
76
78
 
77
79
  it 'should return the correct entry' do
78
- #Some of the drivers starts autoincrementation from 0 not 1
79
- @values.first.should.satisfy { |val| val == 1 or val == 2 }
80
+ #Some of the drivers starts autoincrementation from 0 not 1
81
+ @values.first.should satisfy { |val| val == 1 or val == 2 }
80
82
  end
81
83
 
82
84
  end
83
85
 
84
86
  end
85
87
 
86
- shared 'supporting Float autocasting' do
88
+ shared_examples_for 'supporting Float autocasting' do
87
89
 
88
- setup_test_environment
90
+ before :all do
91
+ setup_test_environment
92
+ end
89
93
 
90
94
  before do
91
95
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -110,8 +114,8 @@ shared 'supporting Float autocasting' do
110
114
  end
111
115
 
112
116
  it 'should return the correctly typed result' do
113
- @values.first.should.be.kind_of(Float)
114
- @values.last.should.be.kind_of(Float)
117
+ @values.first.should be_kind_of(Float)
118
+ @values.last.should be_kind_of(Float)
115
119
  end
116
120
 
117
121
  it 'should return the correct result' do
@@ -1,6 +1,8 @@
1
- shared 'supporting Integer' do
1
+ shared_examples_for 'supporting Integer' do
2
2
 
3
- setup_test_environment
3
+ before :all do
4
+ setup_test_environment
5
+ end
4
6
 
5
7
  before do
6
8
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -25,12 +27,12 @@ shared 'supporting Integer' do
25
27
  end
26
28
 
27
29
  it 'should return the correctly typed result' do
28
- @values.first.should.be.kind_of(Integer)
30
+ @values.first.should be_kind_of(Integer)
29
31
  end
30
32
 
31
33
  it 'should return the correct result' do
32
34
  #Some of the drivers starts autoincrementation from 0 not 1
33
- @values.first.should.satisfy { |val| val == 1 or val == 0 }
35
+ @values.first.should satisfy { |val| val == 1 or val == 0 }
34
36
  end
35
37
 
36
38
  end
@@ -50,7 +52,7 @@ shared 'supporting Integer' do
50
52
  end
51
53
 
52
54
  it 'should return the correctly typed result' do
53
- @values.first.should.be.kind_of(Integer)
55
+ @values.first.should be_kind_of(Integer)
54
56
  end
55
57
 
56
58
  it 'should return the correct result' do
@@ -1,6 +1,8 @@
1
- shared 'supporting Nil' do
1
+ shared_examples_for 'supporting Nil' do
2
2
 
3
- setup_test_environment
3
+ before :all do
4
+ setup_test_environment
5
+ end
4
6
 
5
7
  before do
6
8
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -27,7 +29,7 @@ shared 'supporting Nil' do
27
29
  end
28
30
 
29
31
  it 'should return the correctly typed result' do
30
- @values.first.should.be.kind_of(NilClass)
32
+ @values.first.should be_kind_of(NilClass)
31
33
  end
32
34
 
33
35
  it 'should return the correct result' do
@@ -40,9 +42,11 @@ shared 'supporting Nil' do
40
42
 
41
43
  end
42
44
 
43
- shared 'supporting writing an Nil' do
45
+ shared_examples_for 'supporting writing an Nil' do
44
46
 
45
- setup_test_environment
47
+ before :all do
48
+ setup_test_environment
49
+ end
46
50
 
47
51
  before do
48
52
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -53,24 +57,24 @@ shared 'supporting writing an Nil' do
53
57
  end
54
58
 
55
59
 
56
- describe 'supporting writing an Nil' do
60
+ describe 'supporting writing an Nil' do
57
61
  # see as an example oracle
58
62
  # http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements005.htm#sthref487
59
63
  # http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/conditions013.htm#i1050801
60
64
 
61
65
  describe 'as a parameter' do
62
66
 
63
- before do
64
- @reader = @connection.create_command("SELECT id FROM widgets WHERE ad_description IN (?) ORDER BY id").execute_reader(nil)
67
+ before do
68
+ @reader = @connection.create_command("SELECT id FROM widgets WHERE ad_description IN (?) ORDER BY id").execute_reader(nil)
65
69
  end
66
70
 
67
- after do
68
- @reader.close
69
- end
71
+ after do
72
+ @reader.close
73
+ end
70
74
 
71
- it 'should return the correct entry' do
72
- @reader.next!.should.be.false
73
- end
75
+ it 'should return the correct entry' do
76
+ @reader.next!.should be_false
77
+ end
74
78
 
75
79
  end
76
80
 
@@ -78,9 +82,11 @@ shared 'supporting writing an Nil' do
78
82
 
79
83
  end
80
84
 
81
- shared 'supporting Nil autocasting' do
85
+ shared_examples_for 'supporting Nil autocasting' do
82
86
 
83
- setup_test_environment
87
+ before :all do
88
+ setup_test_environment
89
+ end
84
90
 
85
91
  before do
86
92
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -105,7 +111,7 @@ shared 'supporting Nil autocasting' do
105
111
  end
106
112
 
107
113
  it 'should return the correctly typed result' do
108
- @values.first.should.be.kind_of(NilClass)
114
+ @values.first.should be_kind_of(NilClass)
109
115
  end
110
116
 
111
117
  it 'should return the correct result' do