unidom-article_number 2.3.6 → 2.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -0
- data/lib/rspec/models/unidom/article_number/concerns/as_barcode_shared_examples.rb +19 -0
- data/lib/rspec/models/unidom/article_number/ean13_barcode_spec.rb +3 -3
- data/lib/rspec/models/unidom/article_number/ean8_barcode_spec.rb +3 -3
- data/lib/rspec/models/unidom/article_number/vehicle_identification_number_spec.rb +2 -1
- data/lib/unidom/article_number/rspec_shared_examples.rb +1 -0
- data/lib/unidom/article_number/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 248e1950264218c42ce7fa73f4f9a9e1f4713da7
|
4
|
+
data.tar.gz: 45e8641359ebff9cb281d3d0e72a145e94738756
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d409d4f23cce1bca92540edb4dcb11e80f29401bda103b93a636a4723207a88c8f56f53a18f6734f532c995518469a6941cf8a5c0a0cb44e5a0396983a33ff7
|
7
|
+
data.tar.gz: c741d170aa887ba2415198b1fc43fb51435db14868514e1032cffab662f7934b1bec8c9e7a00f5ddf282e6670ad5dc49791a96bd1eca10b99cac24ed4404b6df
|
data/README.md
CHANGED
@@ -120,6 +120,8 @@ end
|
|
120
120
|
|
121
121
|
## RSpec examples
|
122
122
|
|
123
|
+
### RSpec example manifest (run automatically)
|
124
|
+
|
123
125
|
```ruby
|
124
126
|
# spec/models/unidom_spec.rb
|
125
127
|
require 'unidom/article_number/models_rspec'
|
@@ -130,3 +132,31 @@ require 'unidom/article_number/types_rspec'
|
|
130
132
|
# spec/validators/unidom_spec.rb
|
131
133
|
require 'unidom/article_number/validators_rspec'
|
132
134
|
```
|
135
|
+
|
136
|
+
### RSpec shared examples (to be integrated)
|
137
|
+
|
138
|
+
```ruby
|
139
|
+
# The Unidom::ArticleNumber::Ean13Barcode model, the Unidom::ArticleNumber::Ean8Barcode model, & the Unidom::ArticleNumber::VehicleIdentificationNumber model already include the Unidom::ArticleNumber::Concerns::AsBarcode concern
|
140
|
+
|
141
|
+
# app/models/your_barcode.rb
|
142
|
+
class YourBarcode < ActiveRecord::Base
|
143
|
+
|
144
|
+
include Unidom::Common::Concerns::ModelExtension
|
145
|
+
include Unidom::ArticleNumber::Concerns::AsBarcode
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
# spec/support/unidom_rspec_shared_examples.rb
|
150
|
+
require 'unidom/article_number/rspec_shared_examples'
|
151
|
+
|
152
|
+
# spec/models/your_barcode_spec.rb
|
153
|
+
describe YourBarcode do
|
154
|
+
|
155
|
+
model_attribtues = {
|
156
|
+
code: 'AABBCCDDEEFF'
|
157
|
+
}
|
158
|
+
|
159
|
+
it_behaves_like 'Unidom::ArticleNumber::Concerns::AsBarcode', model_attribtues
|
160
|
+
|
161
|
+
end
|
162
|
+
```
|
@@ -0,0 +1,19 @@
|
|
1
|
+
shared_examples 'Unidom::ArticleNumber::Concerns::AsBarcode' do |model_attributes|
|
2
|
+
|
3
|
+
marking_1_attribtues = {
|
4
|
+
marked_id: SecureRandom.uuid,
|
5
|
+
marked_type: 'Unidom::ArticleNumber::Marked::Mock',
|
6
|
+
marker_id: SecureRandom.uuid,
|
7
|
+
marker_type: 'Unidom::ArticleNumber::Marker::Mock'
|
8
|
+
}
|
9
|
+
|
10
|
+
marking_2_attribtues = {
|
11
|
+
marked_id: SecureRandom.uuid,
|
12
|
+
marked_type: 'Unidom::ArticleNumber::Marked::Mock',
|
13
|
+
marker_id: SecureRandom.uuid,
|
14
|
+
marker_type: 'Unidom::ArticleNumber::Marker::Mock'
|
15
|
+
}
|
16
|
+
|
17
|
+
it_behaves_like 'has_many', model_attributes, :markings, Unidom::ArticleNumber::Marking, [ marking_1_attribtues, marking_2_attribtues ]
|
18
|
+
|
19
|
+
end
|
@@ -12,10 +12,10 @@ describe Unidom::ArticleNumber::Ean13Barcode, type: :model do
|
|
12
12
|
code: '1234567890123'
|
13
13
|
}
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
15
|
+
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
16
|
+
it_behaves_like 'Unidom::ArticleNumber::Concerns::AsBarcode', model_attributes
|
18
17
|
|
18
|
+
code_max_length = described_class.columns_hash['code'].limit
|
19
19
|
it_behaves_like 'validates', model_attributes, :code,
|
20
20
|
{ } => 0,
|
21
21
|
{ code: nil } => 3,
|
@@ -12,10 +12,10 @@ describe Unidom::ArticleNumber::Ean8Barcode, type: :model do
|
|
12
12
|
code: '12345678'
|
13
13
|
}
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
15
|
+
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
16
|
+
it_behaves_like 'Unidom::ArticleNumber::Concerns::AsBarcode', model_attributes
|
18
17
|
|
18
|
+
code_max_length = described_class.columns_hash['code'].limit
|
19
19
|
it_behaves_like 'validates', model_attributes, :code,
|
20
20
|
{ } => 0,
|
21
21
|
{ code: nil } => 3,
|
@@ -12,7 +12,8 @@ describe Unidom::ArticleNumber::VehicleIdentificationNumber, type: :model do
|
|
12
12
|
code: 'LVHCU165XD5002138'
|
13
13
|
}
|
14
14
|
|
15
|
-
it_behaves_like 'Unidom::Common::Concerns::ModelExtension',
|
15
|
+
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
16
|
+
it_behaves_like 'Unidom::ArticleNumber::Concerns::AsBarcode', model_attributes
|
16
17
|
|
17
18
|
it_behaves_like 'validates', model_attributes, :code,
|
18
19
|
{ } => 0,
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'rspec/models/unidom/article_number/concerns/as_barcode_shared_examples'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-article_number
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- db/migrate/20020102000000_create_unidom_ean_13_barcodes.rb
|
61
61
|
- db/migrate/20020103000000_create_unidom_ean_8_barcodes.rb
|
62
62
|
- db/migrate/20020111000000_create_unidom_vehicle_identification_numbers.rb
|
63
|
+
- lib/rspec/models/unidom/article_number/concerns/as_barcode_shared_examples.rb
|
63
64
|
- lib/rspec/models/unidom/article_number/ean13_barcode_spec.rb
|
64
65
|
- lib/rspec/models/unidom/article_number/ean8_barcode_spec.rb
|
65
66
|
- lib/rspec/models/unidom/article_number/marking_spec.rb
|
@@ -69,6 +70,7 @@ files:
|
|
69
70
|
- lib/unidom/article_number.rb
|
70
71
|
- lib/unidom/article_number/engine.rb
|
71
72
|
- lib/unidom/article_number/models_rspec.rb
|
73
|
+
- lib/unidom/article_number/rspec_shared_examples.rb
|
72
74
|
- lib/unidom/article_number/types_rspec.rb
|
73
75
|
- lib/unidom/article_number/validators_rspec.rb
|
74
76
|
- lib/unidom/article_number/version.rb
|