mv-sqlite 0.1.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- metadata +57 -88
- data/spec/migration_validators/adapters/sqlite_spec.rb +0 -975
- data/spec/mv-sqlite_spec.rb +0 -4
- data/spec/spec_helper.rb +0 -15
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2361c9fc445998d58241a7a73568c9c0fb4fbf8b
|
4
|
+
data.tar.gz: d6ac7c61bedefa20d701915760617f5e9292e28a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a468ad208864bdfcb3fba8685b3df67a07b898219f9f38787afd4244c56ab4d4e32cc209e2a017ce639e629890f9b700b771a0cd5d93d04f0fd14a96201ca260
|
7
|
+
data.tar.gz: 12e1918c43b581fe359614bb193e9259fc0f909fd3d53c15f7c0c70bf7222346932efe9c3f16471a23cd3b7986fc2a441982656c7e97338b18db90052c5ccc83
|
metadata
CHANGED
@@ -1,122 +1,91 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mv-sqlite
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.1.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
6
|
+
authors:
|
8
7
|
- Valeriy Prokopchuk
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
17
14
|
name: sqlite3
|
18
|
-
requirement:
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
version: "0"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
24
20
|
type: :runtime
|
25
21
|
prerelease: false
|
26
|
-
version_requirements:
|
27
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
28
|
name: mv-core
|
29
|
-
requirement:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
version: "0"
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
35
34
|
type: :runtime
|
36
35
|
prerelease: false
|
37
|
-
version_requirements:
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 1.0.0
|
46
|
-
type: :development
|
47
|
-
prerelease: false
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
50
42
|
name: jeweler
|
51
|
-
requirement:
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
version: 1.5.2
|
57
|
-
type: :development
|
58
|
-
prerelease: false
|
59
|
-
version_requirements: *id004
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: rcov
|
62
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
|
-
requirements:
|
65
|
-
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: "0"
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
68
48
|
type: :development
|
69
49
|
prerelease: false
|
70
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
71
55
|
description: Migration Validators project sqlite driver
|
72
56
|
email: vprokopchuk@gmail.com
|
73
57
|
executables: []
|
74
|
-
|
75
58
|
extensions: []
|
76
|
-
|
77
|
-
extra_rdoc_files:
|
59
|
+
extra_rdoc_files:
|
78
60
|
- LICENSE.txt
|
79
61
|
- README.rdoc
|
80
|
-
files:
|
62
|
+
files:
|
81
63
|
- lib/migration_validators/adapters/sqlite.rb
|
82
64
|
- lib/mv-sqlite.rb
|
83
65
|
- LICENSE.txt
|
84
66
|
- README.rdoc
|
85
|
-
- spec/migration_validators/adapters/sqlite_spec.rb
|
86
|
-
- spec/mv-sqlite_spec.rb
|
87
|
-
- spec/spec_helper.rb
|
88
|
-
has_rdoc: true
|
89
67
|
homepage: http://github.com/vprokopchuk256/mv-sqlite
|
90
|
-
licenses:
|
68
|
+
licenses:
|
91
69
|
- MIT
|
70
|
+
metadata: {}
|
92
71
|
post_install_message:
|
93
72
|
rdoc_options: []
|
94
|
-
|
95
|
-
require_paths:
|
73
|
+
require_paths:
|
96
74
|
- lib
|
97
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
none: false
|
108
|
-
requirements:
|
109
|
-
- - ">="
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: "0"
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
112
85
|
requirements: []
|
113
|
-
|
114
86
|
rubyforge_project:
|
115
|
-
rubygems_version: 1.
|
87
|
+
rubygems_version: 2.1.10
|
116
88
|
signing_key:
|
117
|
-
specification_version:
|
89
|
+
specification_version: 4
|
118
90
|
summary: Migration Validators project sqlite driver
|
119
|
-
test_files:
|
120
|
-
- spec/migration_validators/adapters/sqlite_spec.rb
|
121
|
-
- spec/mv-sqlite_spec.rb
|
122
|
-
- spec/spec_helper.rb
|
91
|
+
test_files: []
|
@@ -1,975 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
-
|
3
|
-
describe MigrationValidators::Adapters::Sqlite, :type => :mv_test do
|
4
|
-
before :all do
|
5
|
-
Driver = Class.new(MigrationValidators::Adapters::Base)
|
6
|
-
use_db :adapter => "sqlite3", :pool => 5, :timeout => 5000, :database => "validation_migration_test_db"
|
7
|
-
db.initialize_schema_migrations_table
|
8
|
-
::ActiveRecord::Migration.verbose = false
|
9
|
-
end
|
10
|
-
|
11
|
-
before :each do
|
12
|
-
MigrationValidators::Core::DbValidator.clear_all
|
13
|
-
end
|
14
|
-
|
15
|
-
for_test_table do
|
16
|
-
|
17
|
-
#integer
|
18
|
-
for_integer_column do
|
19
|
-
with_validator :presense do
|
20
|
-
with_option :as => :trigger do
|
21
|
-
it { should allow(5) }
|
22
|
-
it { should deny(nil).with_initial(5) }
|
23
|
-
end
|
24
|
-
|
25
|
-
with_option :allow_blank => true do
|
26
|
-
it { should allow(nil) }
|
27
|
-
end
|
28
|
-
|
29
|
-
with_option :allow_nil => true do
|
30
|
-
it { should allow(nil) }
|
31
|
-
end
|
32
|
-
|
33
|
-
with_option :on => :update do
|
34
|
-
it { should allow.insert(nil) }
|
35
|
-
end
|
36
|
-
|
37
|
-
with_option :on => :create do
|
38
|
-
it { should allow.update(nil).with_initial(5) }
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
with_validator :inclusion do
|
43
|
-
with_option :as => :trigger do
|
44
|
-
#closed integer interval
|
45
|
-
with_options :in => 1..9 do
|
46
|
-
it { should allow(1,4,9) }
|
47
|
-
it { should deny(0, 10).with_initial(1) }
|
48
|
-
end
|
49
|
-
|
50
|
-
#open integer interval
|
51
|
-
with_options :in => 1...9 do
|
52
|
-
it { should allow(1,4) }
|
53
|
-
it { should deny(0, 9, 10).with_initial(1) }
|
54
|
-
end
|
55
|
-
|
56
|
-
#single value
|
57
|
-
with_options :in => 9 do
|
58
|
-
it { should allow(9) }
|
59
|
-
it { should deny(8, 10).with_initial(9) }
|
60
|
-
end
|
61
|
-
|
62
|
-
#array
|
63
|
-
with_options :in => [1, 9] do
|
64
|
-
it { should allow(1, 9) }
|
65
|
-
it { should deny(0, 3, 10).with_initial(1) }
|
66
|
-
end
|
67
|
-
|
68
|
-
with_options :in => 9, :message => "Some error message" do
|
69
|
-
it { should deny(8, 10).with_initial(9).and_message(/Some error message/) }
|
70
|
-
|
71
|
-
with_option :on => :update do
|
72
|
-
it { should allow.insert(8, 10) }
|
73
|
-
end
|
74
|
-
|
75
|
-
with_option :on => :create do
|
76
|
-
it { should allow.update(8, 10).with_initial(9) }
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
with_validator :exclusion do
|
83
|
-
with_option :as => :trigger do
|
84
|
-
#closed integer interval
|
85
|
-
with_options :in => 1..9 do
|
86
|
-
it { should allow(0, 10) }
|
87
|
-
it { should deny(1,4,9).with_initial(0) }
|
88
|
-
end
|
89
|
-
|
90
|
-
#open integer intervalw
|
91
|
-
with_options :in => 1...9 do
|
92
|
-
it { should allow(0, 9, 10) }
|
93
|
-
it { should deny(1,4).with_initial(0) }
|
94
|
-
end
|
95
|
-
|
96
|
-
#single value
|
97
|
-
with_options :in => 9 do
|
98
|
-
it { should allow(8, 10) }
|
99
|
-
it { should deny(9).with_initial(0) }
|
100
|
-
end
|
101
|
-
|
102
|
-
#array
|
103
|
-
with_options :in => [1, 9] do
|
104
|
-
it { should allow(0, 3, 10) }
|
105
|
-
it { should deny(1, 9).with_initial(0) }
|
106
|
-
end
|
107
|
-
|
108
|
-
with_options :in => 9, :message => "Some error message" do
|
109
|
-
it { should deny(9).with_initial(8).and_message(/Some error message/) }
|
110
|
-
|
111
|
-
with_option :on => :update do
|
112
|
-
it { should allow.insert(9) }
|
113
|
-
end
|
114
|
-
|
115
|
-
with_option :on => :create do
|
116
|
-
it { should allow.update(9).with_initial(8) }
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
with_validator :uniqueness do
|
124
|
-
with_option :as => :trigger do
|
125
|
-
it { should deny.insert.at_least_one(1,1)}
|
126
|
-
it { should deny.update(1).with_initial(1,2)}
|
127
|
-
it { should allow.insert(1,2,3) }
|
128
|
-
|
129
|
-
with_option :message => "Some error message" do
|
130
|
-
it { should deny.at_least_one(1,1).with_initial(1).and_message(/Some error message/) }
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
with_option :as => :index do
|
135
|
-
it { should deny.insert.at_least_one(1,1).with_message(/is not unique/) }
|
136
|
-
it { should deny.update(1).with_initial(1,2).and_message(/is not unique/) }
|
137
|
-
it { should allow.insert(1,2,3) }
|
138
|
-
it { should allow.update(1).with_initial(2) }
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
for_integer_column :validates => {:uniqueness => {:as => :index, :message => "Some error message"}, :inclusion => {:in => 1..9, :as => :trigger, :message => "Some error message"}} do
|
144
|
-
it { should deny.at_least_one(1,1).with_initial(1, 2).and_message(/is not unique/) }
|
145
|
-
it { should deny(10).with_initial(8).and_message(/Some error message/) }
|
146
|
-
|
147
|
-
with_change :inclusion => false do
|
148
|
-
it { should deny.at_least_one(1,1).with_initial(1, 2).and_message(/is not unique/) }
|
149
|
-
it { should allow(10) }
|
150
|
-
end
|
151
|
-
|
152
|
-
with_change :inclusion => {:in => 1..9} do
|
153
|
-
with_change :inclusion => false do
|
154
|
-
it { should allow(10) }
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
for_integer_column :validates => {:uniqueness => {:as => :index, :message => "Some error message"}, :exclusion => {:in => 4..9, :as => :trigger, :message => "Some error message"}} do
|
160
|
-
it { should deny.at_least_one(1,1).with_initial(1, 2).and_message(/is not unique/) }
|
161
|
-
it { should deny(9).with_initial(10).and_message(/Some error message/) }
|
162
|
-
|
163
|
-
with_change :exclusion => false do
|
164
|
-
it { should deny.at_least_one(1,1).with_initial(1, 2).and_message(/is not unique/) }
|
165
|
-
it { should allow(9) }
|
166
|
-
end
|
167
|
-
|
168
|
-
with_change :exclusion => {:in => 4..9} do
|
169
|
-
with_change :exclusion => false do
|
170
|
-
it { should allow(9) }
|
171
|
-
end
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
for_integer_column :validates => {:uniqueness => {:as => :index, :message => "Some error message"}, :presense => {:as => :trigger, :message => "Some error message"}} do
|
176
|
-
it { should deny.at_least_one(1,1).with_initial(1, 2).and_message(/is not unique/) }
|
177
|
-
it { should deny(nil).with_initial(10).and_message(/Some error message/) }
|
178
|
-
|
179
|
-
with_change :presense => false do
|
180
|
-
it { should deny.at_least_one(1,1).with_initial(1, 2).and_message(/is not unique/) }
|
181
|
-
it { should allow(nil) }
|
182
|
-
end
|
183
|
-
|
184
|
-
with_change :presense => true do
|
185
|
-
with_change :presense => false do
|
186
|
-
it { should allow(nil) }
|
187
|
-
end
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
|
192
|
-
#float
|
193
|
-
for_float_column do
|
194
|
-
|
195
|
-
with_validator :presense do
|
196
|
-
with_option :as => :trigger do
|
197
|
-
it { should allow(1.1) }
|
198
|
-
it { should deny(nil).with_initial(1.1) }
|
199
|
-
end
|
200
|
-
|
201
|
-
with_option :allow_blank => true do
|
202
|
-
it { should allow(nil) }
|
203
|
-
end
|
204
|
-
|
205
|
-
with_option :allow_nil => true do
|
206
|
-
it { should allow(nil) }
|
207
|
-
end
|
208
|
-
|
209
|
-
with_option :on => :update do
|
210
|
-
it { should allow.insert(nil) }
|
211
|
-
end
|
212
|
-
|
213
|
-
with_option :on => :create do
|
214
|
-
it { should allow.update(nil).with_initial(1.1) }
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
with_validator :inclusion do
|
219
|
-
with_option :as => :trigger do
|
220
|
-
#closed integer interval
|
221
|
-
with_options :in => 1.1..9.1 do
|
222
|
-
it { should allow(1.1, 9.1) }
|
223
|
-
it { should deny(1.0, 9.2).with_initial(1.1) }
|
224
|
-
end
|
225
|
-
|
226
|
-
#open integer interval
|
227
|
-
with_options :in => 1.1...9.1 do
|
228
|
-
it { should allow(1.1, 9) }
|
229
|
-
it { should deny(1.0, 9.1, 9.2).with_initial(1.1) }
|
230
|
-
end
|
231
|
-
|
232
|
-
#single value
|
233
|
-
with_options :in => 9.1 do
|
234
|
-
it { should allow(9.1) }
|
235
|
-
it { should deny(8.1, 10.1).with_initial(9.1) }
|
236
|
-
end
|
237
|
-
|
238
|
-
#array
|
239
|
-
with_options :in => [1.1, 9.1] do
|
240
|
-
it { should allow(1.1, 9.1) }
|
241
|
-
it { should deny(0.1, 3.1, 10.1).with_initial(1.1) }
|
242
|
-
end
|
243
|
-
|
244
|
-
with_options :in => 9.1, :message => "Some error message" do
|
245
|
-
it { should deny(8.1, 10.1).with_initial(9.1).and_message(/Some error message/) }
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
with_validator :exclusion do
|
251
|
-
with_option :as => :trigger do
|
252
|
-
#closed integer interval
|
253
|
-
with_options :in => 1.1..9.1 do
|
254
|
-
it { should allow(1.0, 9.2) }
|
255
|
-
it { should deny(1.1, 9.1).with_initial(1.0) }
|
256
|
-
end
|
257
|
-
|
258
|
-
#open integer interval
|
259
|
-
with_options :in => 1.1...9.1 do
|
260
|
-
it { should allow(1.0, 9.1, 9.2) }
|
261
|
-
it { should deny(1.1, 9).with_initial(1.0) }
|
262
|
-
end
|
263
|
-
|
264
|
-
#single value
|
265
|
-
with_options :in => 9.1 do
|
266
|
-
it { should deny(9.1).with_initial(9.0) }
|
267
|
-
it { should allow(8.1, 10.1) }
|
268
|
-
end
|
269
|
-
|
270
|
-
#array
|
271
|
-
with_options :in => [1.1, 9.1] do
|
272
|
-
it { should deny(1.1, 9.1).with_initial(1.0) }
|
273
|
-
it { should allow(0.1, 3.1, 10.1) }
|
274
|
-
end
|
275
|
-
|
276
|
-
with_options :in => 9.1, :message => "Some error message" do
|
277
|
-
it { should deny(9.1).with_initial(9.0).and_message(/Some error message/) }
|
278
|
-
end
|
279
|
-
end
|
280
|
-
end
|
281
|
-
end
|
282
|
-
|
283
|
-
#string
|
284
|
-
for_string_column do
|
285
|
-
with_validator :presense do
|
286
|
-
with_option :as => :trigger do
|
287
|
-
it { should allow('b') }
|
288
|
-
it { should deny(nil).with_initial('b') }
|
289
|
-
end
|
290
|
-
|
291
|
-
with_option :allow_blank => true do
|
292
|
-
it { should allow(nil) }
|
293
|
-
end
|
294
|
-
|
295
|
-
with_option :allow_nil => true do
|
296
|
-
it { should allow(nil) }
|
297
|
-
end
|
298
|
-
|
299
|
-
with_option :on => :update do
|
300
|
-
it { should allow.insert(nil) }
|
301
|
-
end
|
302
|
-
|
303
|
-
with_option :on => :create do
|
304
|
-
it { should allow.update(nil).with_initial('b') }
|
305
|
-
end
|
306
|
-
end
|
307
|
-
|
308
|
-
with_validator :uniqueness do
|
309
|
-
with_option :as => :trigger do
|
310
|
-
it { should deny.at_least_one(' ', ' ').with_initial(' ', 'a') }
|
311
|
-
|
312
|
-
with_option :allow_blank => true do
|
313
|
-
it { should allow(' ', ' ') }
|
314
|
-
end
|
315
|
-
end
|
316
|
-
end
|
317
|
-
|
318
|
-
with_validator :inclusion do
|
319
|
-
with_option :as => :trigger do
|
320
|
-
#closed string interval
|
321
|
-
with_options :in => 'b'..'e' do
|
322
|
-
it { should allow('b', 'd', 'e') }
|
323
|
-
it { should deny('a', 'f').with_initial('b') }
|
324
|
-
it { should deny(' ').with_initial('b') }
|
325
|
-
it { should deny(nil).with_initial('b') }
|
326
|
-
|
327
|
-
with_option :allow_blank => true do
|
328
|
-
it { should allow(' ') }
|
329
|
-
end
|
330
|
-
|
331
|
-
with_option :allow_nil => true do
|
332
|
-
it { should allow(nil) }
|
333
|
-
end
|
334
|
-
end
|
335
|
-
|
336
|
-
#open string interval
|
337
|
-
with_options :in => 'b'...'e' do
|
338
|
-
it { should allow('b', 'd') }
|
339
|
-
it { should deny('a', 'e', 'f').with_initial('b') }
|
340
|
-
it { should deny(' ').with_initial('b') }
|
341
|
-
it { should deny(nil).with_initial('b') }
|
342
|
-
|
343
|
-
with_option :allow_blank => true do
|
344
|
-
it { should allow(' ') }
|
345
|
-
end
|
346
|
-
|
347
|
-
with_option :allow_nil => true do
|
348
|
-
it { should allow(nil) }
|
349
|
-
end
|
350
|
-
end
|
351
|
-
|
352
|
-
#single string value
|
353
|
-
with_options :in => 'b' do
|
354
|
-
it { should allow('b') }
|
355
|
-
it { should deny('a', 'c').with_initial('b') }
|
356
|
-
it { should deny(' ').with_initial('b') }
|
357
|
-
it { should deny(nil).with_initial('b') }
|
358
|
-
|
359
|
-
with_option :allow_blank => true do
|
360
|
-
it { should allow(' ') }
|
361
|
-
end
|
362
|
-
|
363
|
-
with_option :allow_nil => true do
|
364
|
-
it { should allow(nil) }
|
365
|
-
end
|
366
|
-
end
|
367
|
-
|
368
|
-
#array
|
369
|
-
with_options :in => ['b', 'e'] do
|
370
|
-
it { should allow('b', 'e') }
|
371
|
-
it { should deny('a', 'c', 'f').with_initial('b') }
|
372
|
-
it { should deny(' ').with_initial('b') }
|
373
|
-
it { should deny(nil).with_initial('b') }
|
374
|
-
|
375
|
-
with_option :allow_blank => true do
|
376
|
-
it { should allow(' ') }
|
377
|
-
end
|
378
|
-
|
379
|
-
with_option :allow_nil => true do
|
380
|
-
it { should allow(nil) }
|
381
|
-
end
|
382
|
-
end
|
383
|
-
|
384
|
-
with_options :in => 'b' do
|
385
|
-
it { should allow('b') }
|
386
|
-
|
387
|
-
with_option :message => "Some error message" do
|
388
|
-
it { should deny('c').with_initial('b').with_message(/Some error message/) }
|
389
|
-
end
|
390
|
-
|
391
|
-
it { should deny(' ').with_initial('b') }
|
392
|
-
|
393
|
-
with_option :allow_blank => true do
|
394
|
-
it { should allow(' ') }
|
395
|
-
end
|
396
|
-
end
|
397
|
-
end
|
398
|
-
end
|
399
|
-
|
400
|
-
with_validator :exclusion do
|
401
|
-
with_option :as => :trigger do
|
402
|
-
#closed string interval
|
403
|
-
with_options :in => 'b'..'e' do
|
404
|
-
it { should allow('a', 'f') }
|
405
|
-
it { should deny('b', 'd', 'e').with_initial('a') }
|
406
|
-
it { should allow(nil) }
|
407
|
-
end
|
408
|
-
|
409
|
-
#open string interval
|
410
|
-
with_options :in => 'b'...'e' do
|
411
|
-
it { should deny('b', 'd').with_initial('a') }
|
412
|
-
it { should allow('a', 'e', 'f') }
|
413
|
-
it { should allow(nil) }
|
414
|
-
end
|
415
|
-
|
416
|
-
#single string value
|
417
|
-
with_options :in => 'b' do
|
418
|
-
it { should deny('b').with_initial('a') }
|
419
|
-
it { should allow('a', 'c') }
|
420
|
-
it { should allow(nil) }
|
421
|
-
end
|
422
|
-
|
423
|
-
#array
|
424
|
-
with_options :in => ['b', 'e', ' '] do
|
425
|
-
it { should deny('b', 'e').with_initial('a') }
|
426
|
-
it { should allow('a', 'c', 'f') }
|
427
|
-
it { should deny(' ').with_initial('a') }
|
428
|
-
it { should allow(nil) }
|
429
|
-
|
430
|
-
with_option :allow_blank => true do
|
431
|
-
it { should allow(' ') }
|
432
|
-
end
|
433
|
-
end
|
434
|
-
|
435
|
-
with_options :in => 'b', :message => "Some error message" do
|
436
|
-
it { should deny('b').with_initial('a').with_message(/Some error message/) }
|
437
|
-
end
|
438
|
-
end
|
439
|
-
end
|
440
|
-
|
441
|
-
with_validator :length do
|
442
|
-
with_option :as => :trigger do
|
443
|
-
with_option :is => 5 do
|
444
|
-
it {should allow('12345') }
|
445
|
-
it {should deny('1234', '123456').with_initial('12345') }
|
446
|
-
|
447
|
-
with_option :message => "Some error message" do
|
448
|
-
it {should deny('123456').with_initial('12345').with_message("Some error message") }
|
449
|
-
|
450
|
-
with_option :wrong_length => "Some specific error message" do
|
451
|
-
it {should deny('123456').with_initial('12345').with_message("Some specific error message") }
|
452
|
-
end
|
453
|
-
end
|
454
|
-
|
455
|
-
with_option :on => :create do
|
456
|
-
it {should deny.insert('1234', '123456') }
|
457
|
-
it {should allow.update('1234', '123456').with_initial('12345') }
|
458
|
-
end
|
459
|
-
|
460
|
-
with_option :on => :update do
|
461
|
-
it {should allow.insert('1234', '123456') }
|
462
|
-
it {should deny.update('1234', '123456').with_initial('12345') }
|
463
|
-
end
|
464
|
-
|
465
|
-
it {should deny(' ', nil).with_initial('12345') }
|
466
|
-
|
467
|
-
with_option :allow_blank => true do
|
468
|
-
it { should allow.insert(' ') }
|
469
|
-
end
|
470
|
-
|
471
|
-
with_option :allow_nil => true do
|
472
|
-
it { should allow.insert(nil) }
|
473
|
-
end
|
474
|
-
end
|
475
|
-
|
476
|
-
with_option :is => 0 do
|
477
|
-
it { should allow(nil) }
|
478
|
-
end
|
479
|
-
|
480
|
-
|
481
|
-
with_option :maximum => 5 do
|
482
|
-
it {should allow('1234', '12345') }
|
483
|
-
it {should deny('123456').with_initial('12345') }
|
484
|
-
|
485
|
-
with_option :message => "Some error message" do
|
486
|
-
it {should deny('123456').with_initial('12345').with_message("Some error message") }
|
487
|
-
|
488
|
-
with_option :too_long => "Some specific error message" do
|
489
|
-
it {should deny('123456').with_initial('12345').with_message("Some specific error message") }
|
490
|
-
end
|
491
|
-
end
|
492
|
-
|
493
|
-
it { should allow(' ', nil) }
|
494
|
-
end
|
495
|
-
|
496
|
-
with_option :minimum => 5 do
|
497
|
-
it {should allow('12345', '123456') }
|
498
|
-
it {should deny('1234').with_initial('12345') }
|
499
|
-
|
500
|
-
with_option :message => "Some error message" do
|
501
|
-
it {should deny('1234').with_initial('12345').with_message("Some error message") }
|
502
|
-
|
503
|
-
with_option :too_short => "Some specific error message" do
|
504
|
-
it {should deny('1234').with_initial('12345').with_message("Some specific error message") }
|
505
|
-
end
|
506
|
-
end
|
507
|
-
|
508
|
-
it {should deny(' ', nil).with_initial('12345') }
|
509
|
-
|
510
|
-
with_option :allow_blank => true do
|
511
|
-
it { should allow.insert(' ') }
|
512
|
-
end
|
513
|
-
|
514
|
-
with_option :allow_nil => true do
|
515
|
-
it { should allow.insert(nil) }
|
516
|
-
end
|
517
|
-
end
|
518
|
-
|
519
|
-
with_option :minimum => 0 do
|
520
|
-
it { should allow(' ', nil) }
|
521
|
-
end
|
522
|
-
|
523
|
-
with_option :in => 2..5 do
|
524
|
-
it {should allow('12', '123', '12345') }
|
525
|
-
it {should deny('1', '123456').with_initial('12') }
|
526
|
-
|
527
|
-
with_option :message => "Some error message" do
|
528
|
-
it {should deny('1').with_initial('12').with_message("Some error message") }
|
529
|
-
end
|
530
|
-
|
531
|
-
it {should deny(' ', nil).with_initial('12') }
|
532
|
-
|
533
|
-
with_option :allow_blank => true do
|
534
|
-
it { should allow.insert(' ') }
|
535
|
-
end
|
536
|
-
|
537
|
-
with_option :allow_nil => true do
|
538
|
-
it { should allow.insert(nil) }
|
539
|
-
end
|
540
|
-
end
|
541
|
-
|
542
|
-
with_option :in => 0..1 do
|
543
|
-
it { should allow(' ', nil) }
|
544
|
-
end
|
545
|
-
|
546
|
-
with_option :in => 2...5 do
|
547
|
-
it {should allow('12', '123') }
|
548
|
-
it {should deny('1', '12345', '123456').with_initial('12') }
|
549
|
-
|
550
|
-
with_option :message => "Some error message" do
|
551
|
-
it {should deny('1').with_initial('12').with_message("Some error message") }
|
552
|
-
end
|
553
|
-
|
554
|
-
it {should deny(' ', nil).with_initial('12') }
|
555
|
-
|
556
|
-
with_option :allow_blank => true do
|
557
|
-
it { should allow.insert(' ') }
|
558
|
-
end
|
559
|
-
|
560
|
-
with_option :allow_nil => true do
|
561
|
-
it { should allow.insert(nil) }
|
562
|
-
end
|
563
|
-
end
|
564
|
-
|
565
|
-
with_option :in => 0...2 do
|
566
|
-
it { should allow(' ', nil) }
|
567
|
-
end
|
568
|
-
|
569
|
-
with_option :in => [2, 3, 5] do
|
570
|
-
it {should allow('12', '123', '12345') }
|
571
|
-
it {should deny('1', '1234', '123456').with_initial('12') }
|
572
|
-
|
573
|
-
with_option :message => "Some error message" do
|
574
|
-
it {should deny('1').with_initial('12').with_message("Some error message") }
|
575
|
-
end
|
576
|
-
|
577
|
-
it {should deny(' ', nil).with_initial('12') }
|
578
|
-
|
579
|
-
with_option :allow_blank => true do
|
580
|
-
it { should allow.insert(' ') }
|
581
|
-
end
|
582
|
-
|
583
|
-
with_option :allow_nil => true do
|
584
|
-
it { should allow.insert(nil) }
|
585
|
-
end
|
586
|
-
end
|
587
|
-
|
588
|
-
with_option :in => [0, 1] do
|
589
|
-
it { should allow(' ', nil) }
|
590
|
-
end
|
591
|
-
|
592
|
-
with_option :in => 5 do
|
593
|
-
it {should allow('12345') }
|
594
|
-
it {should deny('1234', '123456').with_initial('12345') }
|
595
|
-
end
|
596
|
-
|
597
|
-
with_option :within => 2..5 do
|
598
|
-
it {should allow('12', '123', '12345') }
|
599
|
-
it {should deny('1', '123456').with_initial('12') }
|
600
|
-
|
601
|
-
with_option :message => "Some error message" do
|
602
|
-
it {should deny('1').with_initial('12').with_message("Some error message") }
|
603
|
-
end
|
604
|
-
|
605
|
-
it {should deny(' ', nil).with_initial('12') }
|
606
|
-
|
607
|
-
with_option :allow_blank => true do
|
608
|
-
it { should allow.insert(' ') }
|
609
|
-
end
|
610
|
-
|
611
|
-
with_option :allow_nil => true do
|
612
|
-
it { should allow.insert(nil) }
|
613
|
-
end
|
614
|
-
end
|
615
|
-
|
616
|
-
with_option :within => 0..1 do
|
617
|
-
it { should allow(' ', nil) }
|
618
|
-
end
|
619
|
-
|
620
|
-
with_option :within => 2...5 do
|
621
|
-
it {should allow('12', '123') }
|
622
|
-
it {should deny('1', '12345', '123456').with_initial('12') }
|
623
|
-
|
624
|
-
with_option :message => "Some error message" do
|
625
|
-
it {should deny('1').with_initial('12').with_message("Some error message") }
|
626
|
-
end
|
627
|
-
|
628
|
-
it {should deny(' ', nil).with_initial('12') }
|
629
|
-
|
630
|
-
with_option :allow_blank => true do
|
631
|
-
it { should allow.insert(' ') }
|
632
|
-
end
|
633
|
-
|
634
|
-
with_option :allow_nil => true do
|
635
|
-
it { should allow.insert(nil) }
|
636
|
-
end
|
637
|
-
end
|
638
|
-
|
639
|
-
with_option :within => 0...2 do
|
640
|
-
it { should allow(' ', nil) }
|
641
|
-
end
|
642
|
-
|
643
|
-
with_option :within => [2, 3, 5] do
|
644
|
-
it {should allow('12', '123', '12345') }
|
645
|
-
it {should deny('1', '1234', '123456').with_initial('12') }
|
646
|
-
|
647
|
-
with_option :message => "Some error message" do
|
648
|
-
it {should deny('1').with_initial('12').with_message("Some error message") }
|
649
|
-
end
|
650
|
-
|
651
|
-
it {should deny(' ', nil).with_initial('12') }
|
652
|
-
|
653
|
-
with_option :allow_blank => true do
|
654
|
-
it { should allow.insert(' ') }
|
655
|
-
end
|
656
|
-
|
657
|
-
with_option :allow_nil => true do
|
658
|
-
it { should allow.insert(nil) }
|
659
|
-
end
|
660
|
-
end
|
661
|
-
|
662
|
-
with_option :within => [0, 1] do
|
663
|
-
it { should allow(' ', nil) }
|
664
|
-
end
|
665
|
-
|
666
|
-
with_option :within => 5 do
|
667
|
-
it {should allow('12345') }
|
668
|
-
it {should deny('1234', '123456').with_initial('12345') }
|
669
|
-
end
|
670
|
-
end
|
671
|
-
end
|
672
|
-
end
|
673
|
-
|
674
|
-
for_string_column :validates => {:uniqueness => {:as => :index}, :length => {:in => 4..9, :as => :trigger, :message => "Some error message"}} do
|
675
|
-
it { should deny.at_least_one('1234','1234').with_initial('1234', '12345').and_message(/is not unique/) }
|
676
|
-
it { should deny('123').with_initial('1234').and_message(/Some error message/) }
|
677
|
-
|
678
|
-
with_change :length => false do
|
679
|
-
it { should deny.at_least_one('1234','1234').with_initial('1234', '12345').and_message(/is not unique/) }
|
680
|
-
it { should allow('123') }
|
681
|
-
end
|
682
|
-
|
683
|
-
with_change :length => {:in => 4..9} do
|
684
|
-
with_change :length => false do
|
685
|
-
it { should allow('123') }
|
686
|
-
end
|
687
|
-
end
|
688
|
-
end
|
689
|
-
|
690
|
-
#date
|
691
|
-
for_date_column do
|
692
|
-
startDate = Date.today - 5
|
693
|
-
endDate = Date.today
|
694
|
-
|
695
|
-
with_validator :presense do
|
696
|
-
with_option :as => :trigger do
|
697
|
-
it { should allow(startDate) }
|
698
|
-
it { should deny(nil).with_initial(startDate) }
|
699
|
-
end
|
700
|
-
|
701
|
-
with_option :allow_blank => true do
|
702
|
-
it { should allow(nil) }
|
703
|
-
end
|
704
|
-
|
705
|
-
with_option :allow_nil => true do
|
706
|
-
it { should allow(nil) }
|
707
|
-
end
|
708
|
-
|
709
|
-
with_option :on => :update do
|
710
|
-
it { should allow.insert(nil) }
|
711
|
-
end
|
712
|
-
|
713
|
-
with_option :on => :create do
|
714
|
-
it { should allow.update(nil).with_initial(startDate) }
|
715
|
-
end
|
716
|
-
end
|
717
|
-
|
718
|
-
with_validator :inclusion do
|
719
|
-
with_option :as => :trigger do
|
720
|
-
|
721
|
-
#closed date interval
|
722
|
-
with_options :in => startDate..endDate do
|
723
|
-
it { should allow(startDate, endDate - 3, endDate) }
|
724
|
-
it { should deny(startDate - 1, endDate + 1).with_initial(endDate - 1) }
|
725
|
-
end
|
726
|
-
|
727
|
-
#open date interval
|
728
|
-
with_options :in => startDate...endDate do
|
729
|
-
it { should allow(startDate, endDate - 3) }
|
730
|
-
it { should deny(startDate - 1, endDate, endDate + 1).with_initial(endDate - 1) }
|
731
|
-
end
|
732
|
-
|
733
|
-
#single date value
|
734
|
-
with_options :in => endDate do
|
735
|
-
it { should allow(endDate) }
|
736
|
-
it { should deny(endDate - 1, endDate + 1).with_initial(endDate) }
|
737
|
-
end
|
738
|
-
|
739
|
-
#array
|
740
|
-
with_options :in => [startDate, endDate] do
|
741
|
-
it { should allow(startDate, endDate) }
|
742
|
-
it { should deny(startDate - 1, endDate - 1, endDate + 1).with_initial(endDate) }
|
743
|
-
end
|
744
|
-
|
745
|
-
with_options :in => endDate, :message => "Some error message" do
|
746
|
-
it { should deny(endDate + 1).with_initial(endDate).with_message(/Some error message/) }
|
747
|
-
end
|
748
|
-
end
|
749
|
-
end
|
750
|
-
|
751
|
-
with_validator :exclusion do
|
752
|
-
with_option :as => :trigger do
|
753
|
-
|
754
|
-
#closed date interval
|
755
|
-
with_options :in => startDate..endDate do
|
756
|
-
it { should deny(startDate, endDate - 3, endDate).with_initial(startDate - 1) }
|
757
|
-
it { should allow(startDate - 1, endDate + 1) }
|
758
|
-
end
|
759
|
-
|
760
|
-
#open date interval
|
761
|
-
with_options :in => startDate...endDate do
|
762
|
-
it { should deny(startDate, endDate - 3).with_initial(startDate - 1) }
|
763
|
-
it { should allow(startDate - 1, endDate, endDate + 1) }
|
764
|
-
end
|
765
|
-
|
766
|
-
#single date value
|
767
|
-
with_options :in => endDate do
|
768
|
-
it { should deny(endDate).with_initial(endDate - 1) }
|
769
|
-
it { should allow(endDate - 1, endDate + 1) }
|
770
|
-
end
|
771
|
-
|
772
|
-
#array
|
773
|
-
with_options :in => [startDate, endDate] do
|
774
|
-
it { should deny(startDate, endDate).with_initial(startDate - 1) }
|
775
|
-
it { should allow(startDate - 1, endDate - 1, endDate + 1) }
|
776
|
-
end
|
777
|
-
|
778
|
-
with_options :in => endDate, :message => "Some error message" do
|
779
|
-
it { should deny(endDate).with_initial(endDate - 1).with_message(/Some error message/) }
|
780
|
-
end
|
781
|
-
end
|
782
|
-
end
|
783
|
-
end
|
784
|
-
|
785
|
-
#time
|
786
|
-
for_time_column do
|
787
|
-
startTime = Time.now - 10
|
788
|
-
endTime = Time.now
|
789
|
-
|
790
|
-
with_validator :presense do
|
791
|
-
with_option :as => :trigger do
|
792
|
-
it { should allow(startTime) }
|
793
|
-
it { should deny(nil).with_initial(startTime) }
|
794
|
-
end
|
795
|
-
|
796
|
-
with_option :allow_blank => true do
|
797
|
-
it { should allow(nil) }
|
798
|
-
end
|
799
|
-
|
800
|
-
with_option :allow_nil => true do
|
801
|
-
it { should allow(nil) }
|
802
|
-
end
|
803
|
-
|
804
|
-
with_option :on => :update do
|
805
|
-
it { should allow.insert(nil) }
|
806
|
-
end
|
807
|
-
|
808
|
-
with_option :on => :create do
|
809
|
-
it { should allow.update(nil).with_initial(startTime) }
|
810
|
-
end
|
811
|
-
end
|
812
|
-
|
813
|
-
with_validator :inclusion do
|
814
|
-
with_option :as => :trigger do
|
815
|
-
|
816
|
-
#closed time interval
|
817
|
-
with_options :in => startTime..endTime do
|
818
|
-
it { should allow(startTime, startTime + 1, endTime) }
|
819
|
-
it { should deny(startTime - 1, endTime + 1).with_initial(startTime) }
|
820
|
-
end
|
821
|
-
|
822
|
-
#open time interval
|
823
|
-
with_options :in => startTime...endTime do
|
824
|
-
it { should allow(startTime, startTime + 1, endTime - 1) }
|
825
|
-
it { should deny(startTime - 1, endTime).with_initial(startTime) }
|
826
|
-
end
|
827
|
-
|
828
|
-
#single time value
|
829
|
-
with_options :in => startTime do
|
830
|
-
it { should allow(startTime) }
|
831
|
-
it { should deny(startTime - 1, endTime).with_initial(startTime) }
|
832
|
-
end
|
833
|
-
|
834
|
-
#array
|
835
|
-
with_options :in => [startTime, endTime] do
|
836
|
-
it { should allow(startTime, endTime) }
|
837
|
-
it { should deny(startTime - 1, startTime + 1, endTime + 1).with_initial(startTime) }
|
838
|
-
end
|
839
|
-
|
840
|
-
with_options :in => startTime, :message => "Some error message" do
|
841
|
-
it { should deny(startTime + 1).with_initial(startTime).with_message(/Some error message/) }
|
842
|
-
end
|
843
|
-
end
|
844
|
-
end
|
845
|
-
|
846
|
-
with_validator :exclusion do
|
847
|
-
with_option :as => :trigger do
|
848
|
-
|
849
|
-
#closed time interval
|
850
|
-
with_options :in => startTime..endTime do
|
851
|
-
it { should deny(startTime, startTime + 1, endTime).with_initial(startTime - 1) }
|
852
|
-
it { should allow(startTime - 1, endTime + 1) }
|
853
|
-
end
|
854
|
-
|
855
|
-
#open time interval
|
856
|
-
with_options :in => startTime...endTime do
|
857
|
-
it { should deny(startTime, startTime + 1, endTime - 1).with_initial(startTime - 1) }
|
858
|
-
it { should allow(startTime - 1, endTime) }
|
859
|
-
end
|
860
|
-
|
861
|
-
#single time value
|
862
|
-
with_options :in => startTime do
|
863
|
-
it { should deny(startTime).with_initial(startTime - 1) }
|
864
|
-
it { should allow(startTime - 1, endTime) }
|
865
|
-
end
|
866
|
-
|
867
|
-
#array
|
868
|
-
with_options :in => [startTime, endTime] do
|
869
|
-
it { should deny(startTime, endTime).with_initial(startTime - 1) }
|
870
|
-
it { should allow(startTime - 1, startTime + 1, endTime + 1)}
|
871
|
-
end
|
872
|
-
|
873
|
-
with_options :in => startTime, :message => "Some error message" do
|
874
|
-
it { should deny(startTime).with_initial(startTime - 1).with_message(/Some error message/) }
|
875
|
-
end
|
876
|
-
end
|
877
|
-
end
|
878
|
-
end
|
879
|
-
|
880
|
-
#datetime
|
881
|
-
for_time_column do
|
882
|
-
startDateTime = DateTime.now - 10
|
883
|
-
endDateTime = DateTime.now
|
884
|
-
|
885
|
-
with_validator :presense do
|
886
|
-
with_option :as => :trigger do
|
887
|
-
it { should allow(startDateTime) }
|
888
|
-
it { should deny(nil).with_initial(startDateTime) }
|
889
|
-
end
|
890
|
-
|
891
|
-
with_option :allow_blank => true do
|
892
|
-
it { should allow(nil) }
|
893
|
-
end
|
894
|
-
|
895
|
-
with_option :allow_nil => true do
|
896
|
-
it { should allow(nil) }
|
897
|
-
end
|
898
|
-
|
899
|
-
with_option :on => :update do
|
900
|
-
it { should allow.insert(nil) }
|
901
|
-
end
|
902
|
-
|
903
|
-
with_option :on => :create do
|
904
|
-
it { should allow.update(nil).with_initial(startDateTime) }
|
905
|
-
end
|
906
|
-
end
|
907
|
-
|
908
|
-
with_validator :inclusion do
|
909
|
-
with_option :as => :trigger do
|
910
|
-
|
911
|
-
#closed time interval
|
912
|
-
with_options :in => startDateTime..endDateTime do
|
913
|
-
it { should allow(startDateTime, startDateTime + 1, endDateTime) }
|
914
|
-
it { should deny(startDateTime - 1, endDateTime + 1).with_initial(startDateTime) }
|
915
|
-
end
|
916
|
-
|
917
|
-
#open time interval
|
918
|
-
with_options :in => startDateTime...endDateTime do
|
919
|
-
it { should allow(startDateTime, startDateTime + 1, endDateTime - 1) }
|
920
|
-
it { should deny(startDateTime - 1, endDateTime).with_initial(startDateTime) }
|
921
|
-
end
|
922
|
-
|
923
|
-
#single time value
|
924
|
-
with_options :in => startDateTime do
|
925
|
-
it { should allow(startDateTime) }
|
926
|
-
it { should deny(startDateTime - 1, endDateTime).with_initial(startDateTime) }
|
927
|
-
end
|
928
|
-
|
929
|
-
#array
|
930
|
-
with_options :in => [startDateTime, endDateTime] do
|
931
|
-
it { should allow(startDateTime, endDateTime) }
|
932
|
-
it { should deny(startDateTime - 1, startDateTime + 1, endDateTime + 1).with_initial(startDateTime) }
|
933
|
-
end
|
934
|
-
|
935
|
-
with_options :in => startDateTime, :message => "Some error message" do
|
936
|
-
it { should deny(startDateTime + 1).with_initial(startDateTime).with_message(/Some error message/) }
|
937
|
-
end
|
938
|
-
end
|
939
|
-
end
|
940
|
-
|
941
|
-
with_validator :exclusion do
|
942
|
-
with_option :as => :trigger do
|
943
|
-
|
944
|
-
#closed time interval
|
945
|
-
with_options :in => startDateTime..endDateTime do
|
946
|
-
it { should deny(startDateTime, startDateTime + 1, endDateTime).with_initial(startDateTime - 1) }
|
947
|
-
it { should allow(startDateTime - 1, endDateTime + 1) }
|
948
|
-
end
|
949
|
-
|
950
|
-
#open time interval
|
951
|
-
with_options :in => startDateTime...endDateTime do
|
952
|
-
it { should deny(startDateTime, startDateTime + 1, endDateTime - 1).with_initial(startDateTime - 1) }
|
953
|
-
it { should allow(startDateTime - 1, endDateTime) }
|
954
|
-
end
|
955
|
-
|
956
|
-
#single time value
|
957
|
-
with_options :in => startDateTime do
|
958
|
-
it { should deny(startDateTime).with_initial(startDateTime - 1) }
|
959
|
-
it { should allow(startDateTime - 1, endDateTime) }
|
960
|
-
end
|
961
|
-
|
962
|
-
#array
|
963
|
-
with_options :in => [startDateTime, endDateTime] do
|
964
|
-
it { should deny(startDateTime, endDateTime).with_initial(startDateTime - 1) }
|
965
|
-
it { should allow(startDateTime - 1, startDateTime + 1, endDateTime + 1) }
|
966
|
-
end
|
967
|
-
|
968
|
-
with_options :in => startDateTime, :message => "Some error message" do
|
969
|
-
it { should deny(startDateTime).with_initial(startDateTime - 1).with_message(/Some error message/) }
|
970
|
-
end
|
971
|
-
end
|
972
|
-
end
|
973
|
-
end
|
974
|
-
end
|
975
|
-
end
|
data/spec/mv-sqlite_spec.rb
DELETED
data/spec/spec_helper.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
require 'rspec'
|
4
|
-
require 'mv-test'
|
5
|
-
require 'mv-sqlite'
|
6
|
-
require 'shoulda'
|
7
|
-
require 'factory_girl'
|
8
|
-
|
9
|
-
# Requires supporting files with custom matchers and macros, etc,
|
10
|
-
# in ./support/ and its subdirectories.
|
11
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
12
|
-
|
13
|
-
RSpec.configure do |config|
|
14
|
-
|
15
|
-
end
|