geopolitical 0.8.7 → 0.8.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/city.rb +21 -7
- data/app/models/concerns/geopolitocracy.rb +5 -4
- data/app/models/hood.rb +1 -0
- data/app/models/region.rb +2 -1
- data/lib/geopolitical.rb +2 -1
- data/lib/geopolitical/version.rb +1 -1
- data/spec/dummy/config/environments/test.rb +1 -1
- data/spec/dummy/log/test.log +6047 -0
- data/spec/models/city_spec.rb +24 -0
- data/spec/models/nation_spec.rb +4 -0
- metadata +2 -2
data/spec/models/city_spec.rb
CHANGED
@@ -29,6 +29,30 @@ describe City, type: :model do
|
|
29
29
|
expect(City.search('sao paulo').first).to eq(city)
|
30
30
|
end
|
31
31
|
|
32
|
+
it 'should print nicely in #to_s' do
|
33
|
+
city = City.make(name: 'Ibitim', region: Region.make(abbr: 'MG'))
|
34
|
+
expect(city.to_s).to eq('Ibitim/MG')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should print nicely in #to_s' do
|
38
|
+
region = Region.make(name: 'Acre', abbr: nil)
|
39
|
+
city = City.make(name: 'Ibitim', region: region)
|
40
|
+
expect(city.to_s).to eq('Ibitim/Acre')
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should print nicely in #with_region' do
|
44
|
+
region = Region.make(name: 'Acre', abbr: 'AC')
|
45
|
+
city = City.make(name: 'Ibitim', region: region)
|
46
|
+
expect(city.to_s).to eq('Ibitim/AC')
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should print nicely #with_nation' do
|
50
|
+
nation = Nation.make(abbr: 'BR')
|
51
|
+
region = Region.make(abbr: 'MG', nation: nation)
|
52
|
+
city = City.make(name: 'Ibitim', region: region, nation: nation)
|
53
|
+
expect(city.with_nation).to eq('Ibitim/MG/BR')
|
54
|
+
end
|
55
|
+
|
32
56
|
describe 'instance' do
|
33
57
|
let(:nation) { Nation.make! }
|
34
58
|
let(:city) { City.make! }
|
data/spec/models/nation_spec.rb
CHANGED
@@ -9,6 +9,10 @@ describe Nation, type: :model do
|
|
9
9
|
expect(Nation.make(abbr: nil)).to_not be_valid
|
10
10
|
end
|
11
11
|
|
12
|
+
it 'should assign upcase abbr' do
|
13
|
+
expect(Nation.make!(abbr: 'br').abbr).to eq('BR')
|
14
|
+
end
|
15
|
+
|
12
16
|
it 'should validates uniqueness of abbr' do
|
13
17
|
Nation.make!(abbr: 'BR')
|
14
18
|
expect(Nation.make(abbr: 'BR')).to_not be_valid
|
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: 0.8.
|
4
|
+
version: 0.8.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcos Piccinini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|