unidom-geo-china 0.5.6 → 0.5.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: 1920c17fc74ea77c1938b68bf50ece5f72d4b687
4
- data.tar.gz: b2084f41850aba5400f85e573767c7b8eab5e673
3
+ metadata.gz: 6fd4c0d9e03b26fe74231108e84f1213bcad8a3f
4
+ data.tar.gz: 2b2061f680dfdcc795f8a2ab0abe8756a1e1f380
5
5
  SHA512:
6
- metadata.gz: 68cd3274d6b90804b783e735faf511caec0304d0419c1d6738a43a31c5a17b52e7b06091fb4cfdeabff826458c138ca4242f22cbe42ee040418a67aa989a296e
7
- data.tar.gz: 31c2af6e7a7f5a334b9c86801b4ccf84791d83111161dadbf22cb6e7f1c33288370170967e80a9d2b6bde6a988df046b8a15d2d9e8259b31593b3f5b207db9b0
6
+ metadata.gz: a1c6a285032be9c30d0b0dbd39fb5120e2a682b534f44165efabba458b97155dd178578ffc4f8e02d8f169344245608c72dc41576a7e037622ef26f3ef494742
7
+ data.tar.gz: 997a811fb875dda09525b31b402b4da90d97ba7ed2ca38d7d196d19739d78df5bc0023da40ff7b7e57a19107110da3e16ba77aaea9a1ca39467f5a58981c80e3
@@ -0,0 +1,19 @@
1
+ shared_examples 'Unidom::Geo::China::Concerns::AsInferiorRegion' do |model_attributes|
2
+
3
+ before :each do
4
+ end
5
+
6
+ after :each do
7
+ end
8
+
9
+ context do
10
+
11
+ model = described_class.create! model_attributes
12
+
13
+ context '#super_regions' do
14
+ it 'should respond_to #super_regions method' do expect(model).to respond_to(:super_regions) end
15
+ end
16
+
17
+ end
18
+
19
+ end
@@ -1,3 +1,5 @@
1
+ require 'rspec/models/unidom/geo/china/concerns/as_inferior_region_shared_examples'
2
+
1
3
  describe Unidom::Geo::China::Region, type: :model do
2
4
 
3
5
  before :each do
@@ -16,12 +18,11 @@ describe Unidom::Geo::China::Region, type: :model do
16
18
  name: 'Some Region'
17
19
  }
18
20
 
19
- name_max_length = described_class.columns_hash['name'].limit
20
-
21
- it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
22
- it_behaves_like 'Unidom::Geo::Concerns::AsRegion', model_attributes
21
+ it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes.merge(scheme_id: SecureRandom.uuid)
22
+ it_behaves_like 'Unidom::Geo::Concerns::AsRegion', model_attributes.merge(scheme_id: SecureRandom.uuid)
23
+ it_behaves_like 'Unidom::Geo::China::Concerns::AsInferiorRegion', model_attributes.merge(scheme_id: SecureRandom.uuid)
23
24
 
24
- it_behaves_like 'validates', model_attributes, :numeric_code,
25
+ it_behaves_like 'validates', model_attributes.merge(scheme_id: SecureRandom.uuid), :numeric_code,
25
26
  { } => 0,
26
27
  { numeric_code: nil } => 3,
27
28
  { numeric_code: '' } => 3,
@@ -41,9 +42,9 @@ describe Unidom::Geo::China::Region, type: :model do
41
42
  { numeric_code: 1111111 } => 1,
42
43
  { numeric_code: '11111A' } => 1
43
44
 
44
- it_behaves_like 'validates text', model_attributes, :alphabetic_code,
45
+ it_behaves_like 'validates text', model_attributes.merge(scheme_id: SecureRandom.uuid), :alphabetic_code,
45
46
  length: 2..described_class.columns_hash['alphabetic_code'].limit
46
- it_behaves_like 'validates text', model_attributes, :name,
47
+ it_behaves_like 'validates text', model_attributes.merge(scheme_id: SecureRandom.uuid), :name,
47
48
  length: 1..described_class.columns_hash['name'].limit
48
49
 
49
50
  town_1_attributes = {
@@ -56,22 +57,22 @@ describe Unidom::Geo::China::Region, type: :model do
56
57
  name: 'Some Town #2'
57
58
  }
58
59
 
59
- it_behaves_like 'has_many', model_attributes, :towns, Unidom::Geo::China::Town, [ town_1_attributes, town_2_attributes ]
60
+ it_behaves_like 'has_many', model_attributes.merge(scheme_id: SecureRandom.uuid), :towns, Unidom::Geo::China::Town, [ town_1_attributes, town_2_attributes ]
60
61
 
61
62
  it_behaves_like 'scope', :name_is, [
62
- { attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:name] ] },
63
- { attributes_collection: [ model_attributes ], count_diff: 0, args: [ 'Another Region' ] },
64
- { attributes_collection: [ model_attributes.merge(name: 'Another Region') ], count_diff: 0, args: [ model_attributes[:name] ] },
65
- { attributes_collection: [ model_attributes.merge(name: 'Another Region') ], count_diff: 1, args: [ 'Another Region' ] }
63
+ { attributes_collection: [ model_attributes.merge(scheme_id: SecureRandom.uuid ) ], count_diff: 1, args: [ model_attributes[:name] ] },
64
+ { attributes_collection: [ model_attributes.merge(scheme_id: SecureRandom.uuid ) ], count_diff: 0, args: [ 'Another Region' ] },
65
+ { attributes_collection: [ model_attributes.merge(scheme_id: SecureRandom.uuid, name: 'Another Region') ], count_diff: 0, args: [ model_attributes[:name] ] },
66
+ { attributes_collection: [ model_attributes.merge(scheme_id: SecureRandom.uuid, name: 'Another Region') ], count_diff: 1, args: [ 'Another Region' ] }
66
67
  ]
67
68
 
68
69
  it_behaves_like 'scope', :being_virtual, [
69
- { attributes_collection: [ model_attributes ], count_diff: 0, args: [ ] },
70
- { attributes_collection: [ model_attributes ], count_diff: 0, args: [ true ] },
71
- { attributes_collection: [ model_attributes ], count_diff: 1, args: [ false ] },
72
- { attributes_collection: [ model_attributes.merge(virtual: true) ], count_diff: 1, args: [ ] },
73
- { attributes_collection: [ model_attributes.merge(virtual: true) ], count_diff: 1, args: [ true ] },
74
- { attributes_collection: [ model_attributes.merge(virtual: true) ], count_diff: 0, args: [ false ] }
70
+ { attributes_collection: [ model_attributes.merge(scheme_id: SecureRandom.uuid ) ], count_diff: 0, args: [ ] },
71
+ { attributes_collection: [ model_attributes.merge(scheme_id: SecureRandom.uuid ) ], count_diff: 0, args: [ true ] },
72
+ { attributes_collection: [ model_attributes.merge(scheme_id: SecureRandom.uuid ) ], count_diff: 1, args: [ false ] },
73
+ { attributes_collection: [ model_attributes.merge(scheme_id: SecureRandom.uuid, virtual: true) ], count_diff: 1, args: [ ] },
74
+ { attributes_collection: [ model_attributes.merge(scheme_id: SecureRandom.uuid, virtual: true) ], count_diff: 1, args: [ true ] },
75
+ { attributes_collection: [ model_attributes.merge(scheme_id: SecureRandom.uuid, virtual: true) ], count_diff: 0, args: [ false ] }
75
76
  ]
76
77
 
77
78
  end
@@ -1,7 +1,7 @@
1
1
  module Unidom
2
2
  module Geo
3
3
  module China
4
- VERSION = '0.5.6'.freeze
4
+ VERSION = '0.5.7'.freeze
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-geo-china
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.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-23 00:00:00.000000000 Z
11
+ date: 2017-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-geo
@@ -58,6 +58,7 @@ files:
58
58
  - config/routes.rb
59
59
  - db/migrate/20010491560010_create_unidom_china_regions.rb
60
60
  - db/migrate/20010491560020_create_unidom_china_towns.rb
61
+ - lib/rspec/models/unidom/geo/china/concerns/as_inferior_region_shared_examples.rb
61
62
  - lib/rspec/models/unidom/geo/china/region_spec.rb
62
63
  - lib/rspec/models/unidom/geo/china/town_spec.rb
63
64
  - lib/tasks/data_tasks.rake