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.
- data/LICENSE +1 -1
- data/README.markdown +1 -1
- data/Rakefile +6 -32
- data/lib/data_objects/connection.rb +9 -6
- data/lib/data_objects/pooling.rb +1 -1
- data/lib/data_objects/spec/lib/pending_helpers.rb +11 -0
- data/lib/data_objects/spec/{helpers → lib}/ssl.rb +0 -0
- data/lib/data_objects/spec/setup.rb +5 -0
- data/lib/data_objects/spec/{command_spec.rb → shared/command_spec.rb} +54 -50
- data/lib/data_objects/spec/shared/connection_spec.rb +245 -0
- data/lib/data_objects/spec/{encoding_spec.rb → shared/encoding_spec.rb} +41 -43
- data/lib/data_objects/spec/shared/error/sql_error_spec.rb +30 -0
- data/lib/data_objects/spec/{quoting_spec.rb → shared/quoting_spec.rb} +0 -0
- data/lib/data_objects/spec/{reader_spec.rb → shared/reader_spec.rb} +31 -26
- data/lib/data_objects/spec/shared/result_spec.rb +79 -0
- data/lib/data_objects/spec/{typecast → shared/typecast}/array_spec.rb +4 -2
- data/lib/data_objects/spec/{typecast → shared/typecast}/bigdecimal_spec.rb +12 -8
- data/lib/data_objects/spec/{typecast → shared/typecast}/boolean_spec.rb +14 -10
- data/lib/data_objects/spec/{typecast → shared/typecast}/byte_array_spec.rb +6 -4
- data/lib/data_objects/spec/{typecast → shared/typecast}/class_spec.rb +5 -3
- data/lib/data_objects/spec/{typecast → shared/typecast}/date_spec.rb +13 -9
- data/lib/data_objects/spec/{typecast → shared/typecast}/datetime_spec.rb +14 -11
- data/lib/data_objects/spec/{typecast → shared/typecast}/float_spec.rb +17 -13
- data/lib/data_objects/spec/{typecast → shared/typecast}/integer_spec.rb +7 -5
- data/lib/data_objects/spec/{typecast → shared/typecast}/ipaddr_spec.rb +0 -0
- data/lib/data_objects/spec/{typecast → shared/typecast}/nil_spec.rb +23 -17
- data/lib/data_objects/spec/{typecast → shared/typecast}/other_spec.rb +11 -9
- data/lib/data_objects/spec/{typecast → shared/typecast}/range_spec.rb +4 -2
- data/lib/data_objects/spec/{typecast → shared/typecast}/string_spec.rb +10 -8
- data/lib/data_objects/spec/{typecast → shared/typecast}/time_spec.rb +44 -6
- data/lib/data_objects/transaction.rb +9 -0
- data/lib/data_objects/uri.rb +62 -4
- data/lib/data_objects/version.rb +1 -1
- data/spec/command_spec.rb +2 -2
- data/spec/connection_spec.rb +45 -25
- data/spec/pooling_spec.rb +9 -9
- data/spec/reader_spec.rb +11 -12
- data/spec/result_spec.rb +13 -11
- data/spec/spec_helper.rb +1 -16
- data/spec/transaction_spec.rb +9 -11
- data/spec/uri_spec.rb +35 -27
- data/tasks/spec.rake +8 -17
- metadata +40 -56
- data/lib/data_objects/spec/bacon.rb +0 -9
- data/lib/data_objects/spec/connection_spec.rb +0 -217
- data/lib/data_objects/spec/error/sql_error_spec.rb +0 -19
- data/lib/data_objects/spec/helpers/immediate_red_green_output.rb +0 -59
- data/lib/data_objects/spec/helpers/pending.rb +0 -22
- data/lib/data_objects/spec/result_spec.rb +0 -79
- data/tasks/metrics.rake +0 -36
@@ -1,6 +1,8 @@
|
|
1
|
-
|
1
|
+
shared_examples_for 'supporting BigDecimal' do
|
2
2
|
|
3
|
-
|
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
|
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
|
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
|
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
|
-
|
88
|
+
shared_examples_for 'supporting BigDecimal autocasting' do
|
87
89
|
|
88
|
-
|
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
|
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
|
-
|
1
|
+
shared_examples_for 'supporting Boolean' do
|
2
2
|
|
3
|
-
|
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
|
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
|
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
|
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
|
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
|
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
|
-
|
111
|
+
shared_examples_for 'supporting Boolean autocasting' do
|
110
112
|
|
111
|
-
|
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
|
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
|
-
|
1
|
+
shared_examples_for 'supporting ByteArray' do
|
2
2
|
|
3
|
-
|
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
|
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
|
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
|
-
|
1
|
+
shared_examples_for 'supporting Class' do
|
2
2
|
|
3
|
-
|
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
|
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
|
-
|
1
|
+
shared_examples_for 'supporting Date' do
|
2
2
|
|
3
|
-
|
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
|
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
|
56
|
+
@values.first.should be_kind_of(NilClass)
|
55
57
|
end
|
56
58
|
|
57
59
|
it 'should return nil' do
|
58
|
-
@values.first.should
|
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
|
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
|
-
|
88
|
+
shared_examples_for 'supporting Date autocasting' do
|
87
89
|
|
88
|
-
|
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
|
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
|
-
|
3
|
+
shared_examples_for 'supporting DateTime' do
|
4
4
|
|
5
|
-
|
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
|
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
|
59
|
+
@values.first.should be_kind_of(NilClass)
|
58
60
|
end
|
59
61
|
|
60
62
|
it 'should return nil' do
|
61
|
-
@values.first.should
|
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
|
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
|
-
|
118
|
+
shared_examples_for 'supporting DateTime autocasting' do
|
117
119
|
|
118
|
-
|
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
|
147
|
+
@values.first.should be_kind_of(DateTime)
|
144
148
|
end
|
145
149
|
|
146
150
|
it 'should return the correct result' do
|
147
|
-
|
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
|
-
|
1
|
+
shared_examples_for 'supporting Float' do
|
2
2
|
|
3
|
-
|
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
|
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
|
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
|
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
|
61
|
+
@values.first.should be_nil
|
60
62
|
end
|
61
63
|
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
65
|
-
describe 'writing
|
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
|
-
|
79
|
-
|
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
|
-
|
88
|
+
shared_examples_for 'supporting Float autocasting' do
|
87
89
|
|
88
|
-
|
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
|
114
|
-
@values.last.should
|
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
|
-
|
1
|
+
shared_examples_for 'supporting Integer' do
|
2
2
|
|
3
|
-
|
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
|
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
|
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
|
55
|
+
@values.first.should be_kind_of(Integer)
|
54
56
|
end
|
55
57
|
|
56
58
|
it 'should return the correct result' do
|
File without changes
|
@@ -1,6 +1,8 @@
|
|
1
|
-
|
1
|
+
shared_examples_for 'supporting Nil' do
|
2
2
|
|
3
|
-
|
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
|
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
|
-
|
45
|
+
shared_examples_for 'supporting writing an Nil' do
|
44
46
|
|
45
|
-
|
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
|
-
|
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
|
-
|
64
|
-
|
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
|
-
|
68
|
-
|
69
|
-
|
71
|
+
after do
|
72
|
+
@reader.close
|
73
|
+
end
|
70
74
|
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
-
|
85
|
+
shared_examples_for 'supporting Nil autocasting' do
|
82
86
|
|
83
|
-
|
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
|
114
|
+
@values.first.should be_kind_of(NilClass)
|
109
115
|
end
|
110
116
|
|
111
117
|
it 'should return the correct result' do
|