unidom-common-rspec 0.7 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/Gemfile.lock +1 -1
- data/ROADMAP.md +5 -1
- data/lib/unidom/common/rspec/model_extension_shared_examples.rb +26 -26
- data/lib/unidom/common/rspec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76af4426cca01ee290ec6187843f43ee24de1a73
|
4
|
+
data.tar.gz: 9328c848efa8e23bdab6e7ed9f7441faea185365
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e366c40be2be1f72a3e8580e1b1b18ebfc3601eae9b54ca1aa180c48a8a7de001ec89c9637c1d61371bd65a92424b88a25e721b3427650da570ce69c82243643
|
7
|
+
data.tar.gz: a8917c10fefd533dfe66eb7a3704660a153100bc8a235f2b01e11f9af9b3a1e1df55727308e491e5c38008bd7db977a93204ee93d78d2f03730fa92a8a97b7ba
|
data/CHANGELOG.md
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
## v0.5
|
16
16
|
1. Belongs To shared examples
|
17
|
-
2. Improved the Model Extension shared examples for the validates behaviors of the
|
17
|
+
2. Improved the Model Extension shared examples for the validates behaviors of the #``grade`` attribute & the #``priority`` attribute
|
18
18
|
3. Improved the Model Extension shared examples for the scope behaviours of the #priority attribute
|
19
19
|
|
20
20
|
## v0.6
|
@@ -29,3 +29,7 @@
|
|
29
29
|
|
30
30
|
## v0.7
|
31
31
|
1. Each Validator shared examples
|
32
|
+
|
33
|
+
## v0.7.1
|
34
|
+
1. Improve the Model Extension shared examples for the .ordinal_is scope, the .grade_is scope, the .grade_higher_than scope, the .grade_lower_than scope, the .priority_is scope, the .priority_higher_than scope, & the .priority_lower_than scope
|
35
|
+
2. Improve the Model Extension shared examples for the #ordinal validation
|
data/Gemfile.lock
CHANGED
data/ROADMAP.md
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
## v0.5
|
16
16
|
1. Belongs To shared examples
|
17
|
-
2. Improve the Model Extension shared examples for the validates behaviors of the
|
17
|
+
2. Improve the Model Extension shared examples for the validates behaviors of the #``grade`` attribute & the #``priority`` attribute
|
18
18
|
3. Improve the Model Extension shared examples for the scope behaviours of the #priority attribute
|
19
19
|
|
20
20
|
## v0.6
|
@@ -29,3 +29,7 @@
|
|
29
29
|
|
30
30
|
## v0.7
|
31
31
|
1. Each Validator shared examples
|
32
|
+
|
33
|
+
## v0.7.1
|
34
|
+
1. Improve the Model Extension shared examples for the .ordinal_is scope, the .grade_is scope, the .grade_higher_than scope, the .grade_lower_than scope, the .priority_is scope, the .priority_higher_than scope, & the .priority_lower_than scope
|
35
|
+
2. Improve the Model Extension shared examples for the #ordinal validation
|
@@ -131,11 +131,11 @@ shared_examples 'Unidom::Common::Concerns::ModelExtension' do |model_attributes|
|
|
131
131
|
if ordinal_column.present?&&:integer==ordinal_column.type
|
132
132
|
|
133
133
|
it_behaves_like 'validates', model_attributes, :ordinal,
|
134
|
-
{ } =>
|
135
|
-
{ ordinal: nil } =>
|
136
|
-
{ ordinal: '' } =>
|
137
|
-
{ ordinal: 'A' } =>
|
138
|
-
{ ordinal: 'AA' } =>
|
134
|
+
{ } => 0,
|
135
|
+
{ ordinal: nil } => 2,
|
136
|
+
{ ordinal: '' } => 2,
|
137
|
+
{ ordinal: 'A' } => 1,
|
138
|
+
{ ordinal: 'AA' } => 1,
|
139
139
|
{ ordinal: '0' } => 1,
|
140
140
|
{ ordinal: 0 } => 1,
|
141
141
|
{ ordinal: -1 } => 1,
|
@@ -147,9 +147,9 @@ shared_examples 'Unidom::Common::Concerns::ModelExtension' do |model_attributes|
|
|
147
147
|
{ ordinal: 11 } => 0
|
148
148
|
|
149
149
|
it_behaves_like 'scope', :ordinal_is, [
|
150
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:ordinal]-1 ] },
|
151
|
-
{ attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:ordinal] ] },
|
152
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:ordinal]+1 ] }
|
150
|
+
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:ordinal].to_i-1 ] },
|
151
|
+
{ attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:ordinal].to_i ] },
|
152
|
+
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:ordinal].to_i+1 ] }
|
153
153
|
]
|
154
154
|
|
155
155
|
end
|
@@ -216,21 +216,21 @@ shared_examples 'Unidom::Common::Concerns::ModelExtension' do |model_attributes|
|
|
216
216
|
{ grade: 11 } => 0
|
217
217
|
|
218
218
|
it_behaves_like 'scope', :grade_is, [
|
219
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:grade]-1 ] },
|
220
|
-
{ attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:grade] ] },
|
221
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:grade]+1 ] }
|
219
|
+
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:grade].to_i-1 ] },
|
220
|
+
{ attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:grade].to_i ] },
|
221
|
+
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:grade].to_i+1 ] }
|
222
222
|
]
|
223
223
|
|
224
224
|
it_behaves_like 'scope', :grade_higher_than, [
|
225
|
-
{ attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:grade]-1 ] },
|
226
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:grade] ] },
|
227
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:grade]+1 ] }
|
225
|
+
{ attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:grade].to_i-1 ] },
|
226
|
+
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:grade].to_i ] },
|
227
|
+
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:grade].to_i+1 ] }
|
228
228
|
]
|
229
229
|
|
230
230
|
it_behaves_like 'scope', :grade_lower_than, [
|
231
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:grade]-1 ] },
|
232
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:grade] ] },
|
233
|
-
{ attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:grade]+1 ] }
|
231
|
+
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:grade].to_i-1 ] },
|
232
|
+
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:grade].to_i ] },
|
233
|
+
{ attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:grade].to_i+1 ] }
|
234
234
|
]
|
235
235
|
|
236
236
|
end
|
@@ -258,21 +258,21 @@ shared_examples 'Unidom::Common::Concerns::ModelExtension' do |model_attributes|
|
|
258
258
|
{ priority: 11 } => 0
|
259
259
|
|
260
260
|
it_behaves_like 'scope', :priority_is, [
|
261
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:priority]-1 ] },
|
262
|
-
{ attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:priority] ] },
|
263
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:priority]+1 ] }
|
261
|
+
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:priority].to_i-1 ] },
|
262
|
+
{ attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:priority].to_i ] },
|
263
|
+
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:priority].to_i+1 ] }
|
264
264
|
]
|
265
265
|
|
266
266
|
it_behaves_like 'scope', :priority_higher_than, [
|
267
|
-
{ attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:priority]-1 ] },
|
268
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:priority] ] },
|
269
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:priority]+1 ] }
|
267
|
+
{ attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:priority].to_i-1 ] },
|
268
|
+
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:priority].to_i ] },
|
269
|
+
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:priority].to_i+1 ] }
|
270
270
|
]
|
271
271
|
|
272
272
|
it_behaves_like 'scope', :priority_lower_than, [
|
273
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:priority]-1 ] },
|
274
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:priority] ] },
|
275
|
-
{ attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:priority]+1 ] }
|
273
|
+
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:priority].to_i-1 ] },
|
274
|
+
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ model_attributes[:priority].to_i ] },
|
275
|
+
{ attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:priority].to_i+1 ] }
|
276
276
|
]
|
277
277
|
|
278
278
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-common-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-rails
|