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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74103cd6a92bbb282cfcf21b4afe9c7af05fb222
4
- data.tar.gz: 3242e70644755303d151dcd13f74f6fc57d208a6
3
+ metadata.gz: 248e1950264218c42ce7fa73f4f9a9e1f4713da7
4
+ data.tar.gz: 45e8641359ebff9cb281d3d0e72a145e94738756
5
5
  SHA512:
6
- metadata.gz: 4f76fa1454c4d69591d9c0b53b54d7084f00b4b484c4413045287a277f497db142b9e77d2a16b4fe8f160f7aafd58716e323871a01651b20183aa98e25551a51
7
- data.tar.gz: 9158fcf17ced6e26a6cdfeb4eba8522dac6fead3c07be715107e4413e5bfb15dd3f89290cf98ceca0966900a56c787a582c0d825be48c693b1ccd6f06c342f83
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
- code_max_length = described_class.columns_hash['code'].limit
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
- code_max_length = described_class.columns_hash['code'].limit
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', model_attributes
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'
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module ArticleNumber
3
- VERSION = '2.3.6'.freeze
3
+ VERSION = '2.3.7'.freeze
4
4
  end
5
5
  end
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.6
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-17 00:00:00.000000000 Z
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