unidom-common-rspec 0.7 → 0.7.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 904a67634287dbac121b5b35d210f433ae536d91
4
- data.tar.gz: c6060dde237712fffd523537e010b589bc28c513
3
+ metadata.gz: 76af4426cca01ee290ec6187843f43ee24de1a73
4
+ data.tar.gz: 9328c848efa8e23bdab6e7ed9f7441faea185365
5
5
  SHA512:
6
- metadata.gz: 1c8abef5dec7fa64af1b5585cea81935e7495438a3e42f7e595b68536c9d55e9c78d68d01b81c28df814ce875ae2255f7a49309c37324979bb55cadcae778f92
7
- data.tar.gz: 17a555307a90a719361d8808d8e84a9b4aad5d4edb633ac716a6cd3443a3d56233fcf5cdcc63a65a23497b251e2d42c8cb788bc3d92d45c57976c91693328dc9
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 #grade attribute & the #priority attribute
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- unidom-common-rspec (0.6.1)
4
+ unidom-common-rspec (0.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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 #grade attribute & the #priority attribute
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
- { } => 3,
135
- { ordinal: nil } => 3,
136
- { ordinal: '' } => 3,
137
- { ordinal: 'A' } => 2,
138
- { ordinal: 'AA' } => 2,
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
@@ -1,7 +1,7 @@
1
1
  module Unidom
2
2
  module Common
3
3
  module RSpec
4
- VERSION = '0.7'
4
+ VERSION = '0.7.1'
5
5
  end
6
6
  end
7
7
  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: '0.7'
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-18 00:00:00.000000000 Z
11
+ date: 2017-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-rails