geopolitical 1.0.2 → 1.0.3

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.
@@ -1,5 +1,5 @@
1
1
  Fabricator :hood do
2
2
  city
3
- name { sequence(:name) { |i| "#{Faker::Address.city}#{i}" } }
3
+ name { sequence(:name) { |i| "#{Faker::Address.city}#{i}" } }
4
4
  # geom { [rand(30) - 50, rand(40) - 30] }
5
5
  end
@@ -1,4 +1,4 @@
1
1
  Fabricator :nation do
2
- name { sequence { |_i| Faker::Address.country } }
2
+ name { sequence { |_i| Faker::Address.country } }
3
3
  abbr { |c| c[:name].first.upcase + ('A'..'Z').to_a[rand(23)] }
4
4
  end
@@ -16,6 +16,10 @@ describe City, type: :model do
16
16
  expect(city.slug).to eq('patopolis')
17
17
  end
18
18
 
19
+ it 'should avoid dots it\'s own slug' do
20
+ expect(City.create(name: 'Mte. Sto. de MG').slug).to eq('mte-sto-de-mg')
21
+ end
22
+
19
23
  it 'should append region abbr if it\'s a dup' do
20
24
  sp = Region.make(abbr: 'SP')
21
25
  mg = Region.make(abbr: 'MG')
@@ -95,8 +99,10 @@ describe City, type: :model do
95
99
  end
96
100
 
97
101
  describe 'sorting' do
98
- let(:cities) { [City.make!(name: 'Abadia', souls: 500),
99
- City.make!(name: 'Xangrilá', souls: 5000)] }
102
+ let(:cities) do
103
+ [City.make!(name: 'Abadia', souls: 500),
104
+ City.make!(name: 'Xangrilá', souls: 5000)]
105
+ end
100
106
 
101
107
  it 'should sort by name' do
102
108
  expect(City.ordered).to eq cities
@@ -13,6 +13,26 @@ describe Hood, type: :model do
13
13
  expect(Hood.make(city: nil)).to_not be_valid
14
14
  end
15
15
 
16
+ it 'should have a name' do
17
+ expect(Hood.make(name: '')).to_not be_valid
18
+ end
19
+
20
+ it 'should have city slug' do
21
+ city = City.make!(name: 'Gotham')
22
+ hood = Hood.make(name: 'JD. ITALIA', city: city).tap(&:save)
23
+ expect(hood.slug).to eq('gotham-jd-italia')
24
+ end
25
+
26
+ it 'should titleize name' do
27
+ expect(Hood.make(name: 'JD. ITALIA').name).to eq('Jd. Italia')
28
+ end
29
+
30
+ it 'should not have dup name in city' do
31
+ city = City.make!(name: 'Gotham')
32
+ expect(Hood.make!(name: 'Bowery', city: city)).to be_valid
33
+ expect(Hood.make(name: 'Bowery', city: city)).to_not be_valid
34
+ end
35
+
16
36
  it 'should accept area phone code modified regex' do
17
37
  expect(Hood.make(phone: '115555XXXX')).to be_valid
18
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geopolitical
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos Piccinini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-26 00:00:00.000000000 Z
11
+ date: 2016-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -132,6 +132,7 @@ files:
132
132
  - spec/dummy/config/routes.rb
133
133
  - spec/dummy/lib/assets/.keep
134
134
  - spec/dummy/log/.keep
135
+ - spec/dummy/log/test.log
135
136
  - spec/dummy/public/404.html
136
137
  - spec/dummy/public/422.html
137
138
  - spec/dummy/public/500.html
@@ -165,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
166
  version: '0'
166
167
  requirements: []
167
168
  rubyforge_project:
168
- rubygems_version: 2.5.1
169
+ rubygems_version: 2.6.6
169
170
  signing_key:
170
171
  specification_version: 4
171
172
  summary: Geopolitical models for mongoid.
@@ -208,4 +209,5 @@ test_files:
208
209
  - spec/dummy/bin/rake
209
210
  - spec/dummy/bin/bundle
210
211
  - spec/dummy/README.rdoc
212
+ - spec/dummy/log/test.log
211
213
  - spec/dummy/config.ru