geopolitical 0.8.7 → 0.8.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -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! }
@@ -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.7
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-20 00:00:00.000000000 Z
11
+ date: 2014-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails