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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fd4c0d9e03b26fe74231108e84f1213bcad8a3f
|
4
|
+
data.tar.gz: 2b2061f680dfdcc795f8a2ab0abe8756a1e1f380
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
20
|
-
|
21
|
-
it_behaves_like 'Unidom::
|
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
|
63
|
-
{ attributes_collection: [ model_attributes
|
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
|
70
|
-
{ attributes_collection: [ model_attributes
|
71
|
-
{ attributes_collection: [ model_attributes
|
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
|
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.
|
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-
|
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
|