pinpoint 0.4.0 → 0.4.1

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.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +2 -0
  3. data/Rakefile +1 -1
  4. data/lib/pinpoint/address.rb +27 -26
  5. data/lib/pinpoint/config/patterns.rb +1 -1
  6. data/lib/pinpoint/config/us_states.rb +3 -3
  7. data/lib/pinpoint/format.rb +1 -1
  8. data/lib/pinpoint/format/file.rb +1 -2
  9. data/lib/pinpoint/format/list.rb +2 -2
  10. data/lib/pinpoint/format/parser.rb +0 -1
  11. data/lib/pinpoint/format/style.rb +3 -4
  12. data/lib/pinpoint/format/token.rb +1 -1
  13. data/lib/pinpoint/format/token_list.rb +2 -3
  14. data/lib/pinpoint/format/tokenizer.rb +16 -16
  15. data/lib/pinpoint/formatter.rb +1 -2
  16. data/lib/pinpoint/mapable.rb +2 -3
  17. data/lib/pinpoint/mapable_services/google_maps.rb +0 -1
  18. data/lib/pinpoint/mapable_services/mapquest.rb +0 -1
  19. data/lib/pinpoint/mapable_services/yahoo_maps.rb +0 -1
  20. data/lib/pinpoint/model_support.rb +3 -3
  21. data/lib/pinpoint/version.rb +1 -1
  22. data/spec/address_spec.rb +103 -103
  23. data/spec/format/file_spec.rb +5 -5
  24. data/spec/format/list_spec.rb +7 -7
  25. data/spec/format/parser_spec.rb +12 -12
  26. data/spec/format/style_spec.rb +19 -19
  27. data/spec/format/token_set_spec.rb +8 -8
  28. data/spec/format/token_spec.rb +9 -9
  29. data/spec/format/tokenizer_spec.rb +41 -41
  30. data/spec/format_spec.rb +11 -11
  31. data/spec/formatter_spec.rb +46 -43
  32. data/spec/mapable_services/google_maps_spec.rb +6 -6
  33. data/spec/mapable_services/mapquest_spec.rb +6 -6
  34. data/spec/mapable_services/yahoo_maps_spec.rb +6 -6
  35. data/spec/mapable_spec.rb +8 -8
  36. data/spec/model_support_spec.rb +143 -110
  37. data/spec/spec_helper.rb +1 -2
  38. data/spec/support/focused.rb +2 -2
  39. data/spec/support/pending.rb +1 -1
  40. data/spec/validations_spec.rb +57 -60
  41. metadata +39 -50
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ec389cf558be0cf394dc052c78fcab7cead09b1f
4
+ data.tar.gz: 3196679d69559c65e2e325217fe59f5d6f2b0362
5
+ SHA512:
6
+ metadata.gz: ab7ec3591033e820b5123d6df82209929bcdf8103c3a99cf9fd60cdef7d0a773641093fa0449349821ec213e2b789d17e7dcd946dbfd2786e17ff59a0b424788
7
+ data.tar.gz: a337577be69629350c0efb96b54e3bfbf65067d8bd2810c04ccdd85aa75e392ddff02e7e71cb4301064ca419ee84e0db0a898f44eb5b0fd32af9778cfed2ccc6
data/README.md CHANGED
@@ -5,6 +5,8 @@ Pinpoint
5
5
 
6
6
  _(Un)conventional Address Composition for Ruby (and Rails)_
7
7
 
8
+ [![Build Status](https://secure.travis-ci.org/jfelchner/pinpoint.png?branch=master)](http://travis-ci.org/jfelchner/pinpoint) [![Code Climate](https://codeclimate.com/github/jfelchner/pinpoint.png)](https://codeclimate.com/github/jfelchner/pinpoint) [![Code Climate](https://codeclimate.com/github/jfelchner/pinpoint/coverage.png)](https://codeclimate.com/github/jfelchner/pinpoint)
9
+
8
10
  Supported Rubies
9
11
  --------------------------------
10
12
  * MRI Ruby 1.9.2
data/Rakefile CHANGED
@@ -1 +1 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
@@ -6,42 +6,42 @@ module Pinpoint
6
6
  include Mapable
7
7
 
8
8
  ATTRIBUTE_NAMES = [
9
- :name,
10
- :street_and_premises,
11
- :city,
12
- :state,
13
- :county,
14
- :postal_code,
15
- :country,
16
- :latitude,
17
- :longitude
18
- ]
9
+ :name,
10
+ :street_and_premises,
11
+ :city,
12
+ :state,
13
+ :county,
14
+ :postal_code,
15
+ :country,
16
+ :latitude,
17
+ :longitude,
18
+ ]
19
19
 
20
20
  attr_accessor *ATTRIBUTE_NAMES
21
21
 
22
22
  # City Aliases
23
- alias :locality :city
24
- alias :locality= :city=
23
+ alias_method :locality, :city
24
+ alias_method :locality=, :city=
25
25
 
26
26
  # Street Aliases
27
- alias :street :street_and_premises
28
- alias :street= :street_and_premises=
27
+ alias_method :street, :street_and_premises
28
+ alias_method :street=, :street_and_premises=
29
29
 
30
30
  # State Aliases
31
- alias :region :state
32
- alias :region= :state=
33
- alias :province :state
34
- alias :province= :state=
31
+ alias_method :region, :state
32
+ alias_method :region=, :state=
33
+ alias_method :province, :state
34
+ alias_method :province=, :state=
35
35
 
36
36
  # Zip Code Aliases
37
- alias :zip_code :postal_code
38
- alias :zip_code= :postal_code=
39
- alias :zip :postal_code
40
- alias :zip= :postal_code=
37
+ alias_method :zip_code, :postal_code
38
+ alias_method :zip_code=, :postal_code=
39
+ alias_method :zip, :postal_code
40
+ alias_method :zip=, :postal_code=
41
41
 
42
42
  # County Aliases
43
- alias :district :county
44
- alias :district= :county=
43
+ alias_method :district, :county
44
+ alias_method :district=, :county=
45
45
 
46
46
  def initialize(options = {})
47
47
  options.each do |key, value|
@@ -69,11 +69,12 @@ module Pinpoint
69
69
  blank?(country)
70
70
  end
71
71
 
72
- def to_s(options = { :country => :us, :format => :one_line })
72
+ def to_s(options = { country: :us, format: :one_line })
73
73
  Formatter.format(self, options)
74
74
  end
75
75
 
76
- private
76
+ private
77
+
77
78
  def present?(value)
78
79
  !blank?(value)
79
80
  end
@@ -2,6 +2,6 @@ module Pinpoint
2
2
  FORMATS = {
3
3
  # Zip Code: 5 digits
4
4
  # Optionally followed by a dash and 4 more digits
5
- :zip_code => /^\d{5}(?:\-\d{4})?$/,
5
+ zip_code: /\A\d{5}(?:\-\d{4})?\z/,
6
6
  }
7
7
  end
@@ -1,3 +1,3 @@
1
- Pinpoint::US_STATES = %w(AK AL AR AZ CA CO CT DC DE FL GA HI IA ID IL IN KS KY LA MA MD
2
- ME MI MN MO MS MT NC ND NE NH NJ NM NV NY OH OK OR PA RI SC SD TN TX UT VA VT
3
- WA WI WV WY)
1
+ Pinpoint::US_STATES = %w{AK AL AR AZ CA CO CT DC DE FL GA HI IA ID IL IN KS KY LA MA MD
2
+ ME MI MN MO MS MT NC ND NE NH NJ NM NV NY OH OK OR PA RI SC SD TN TX UT VA VT
3
+ WA WI WV WY}
@@ -26,7 +26,7 @@ module Pinpoint
26
26
  # Returns a Format loaded with all of the styles that it is capable of.
27
27
  #
28
28
  def self.lookup_by_country(country)
29
- format = self.new
29
+ format = new
30
30
  format.styles = Pinpoint::Format::File.styles_for(country)
31
31
  format
32
32
  end
@@ -4,7 +4,6 @@ require 'pinpoint/format/style'
4
4
  module Pinpoint
5
5
  class Format
6
6
  class File
7
-
8
7
  ##
9
8
  # Public: Loads the format for the given country from the appropriate
10
9
  # YAML file.
@@ -38,7 +37,7 @@ module Pinpoint
38
37
  end
39
38
 
40
39
  def self.raw_style_data(country)
41
- YAML::load(format_yaml_contents(country))
40
+ YAML.load(format_yaml_contents(country))
42
41
  end
43
42
  end
44
43
  end
@@ -42,11 +42,11 @@ module Pinpoint
42
42
  private
43
43
 
44
44
  def get(country)
45
- self.formats[country]
45
+ formats[country]
46
46
  end
47
47
 
48
48
  def set(country, format)
49
- self.formats[country] = format
49
+ formats[country] = format
50
50
  end
51
51
  end
52
52
  end
@@ -7,7 +7,6 @@ require 'pinpoint/format/tokenizer'
7
7
  module Pinpoint
8
8
  class Format
9
9
  class Parser
10
-
11
10
  ##
12
11
  # Public: Initializes a Parser and converts the passed String into
13
12
  # a TokenList that will be utilized when it is parsed.
@@ -4,7 +4,6 @@ require 'active_support/core_ext/string/output_safety'
4
4
  module Pinpoint
5
5
  class Format
6
6
  class Style
7
-
8
7
  ##
9
8
  # Public: Processes the style information gleaned from the Pinpoint YAML
10
9
  # format and generates a Style from it.
@@ -17,7 +16,7 @@ module Pinpoint
17
16
  # Returns a Pinpoint::Format::Style based on the information passed in.
18
17
  #
19
18
  def self.from_yaml(style_definition)
20
- style = self.new
19
+ style = new
21
20
  style.send(:structure=, Format::Parser.new(style_definition).parse)
22
21
  style
23
22
  end
@@ -57,7 +56,7 @@ module Pinpoint
57
56
  # Returns a String containing data from the context and String literals
58
57
  #
59
58
  def process(structure, context)
60
- processed = "".html_safe
59
+ processed = ''.html_safe
61
60
 
62
61
  structure.each_with_object(processed) do |token, result|
63
62
  result << case token
@@ -70,7 +69,7 @@ module Pinpoint
70
69
  end
71
70
  end
72
71
 
73
- processed.match(no_alphanumerics) ? "".html_safe : processed
72
+ processed.match(no_alphanumerics) ? ''.html_safe : processed
74
73
  end
75
74
 
76
75
  def no_alphanumerics
@@ -39,7 +39,7 @@ module Pinpoint
39
39
  locality: :locality,
40
40
  province: :province,
41
41
  postal_code: :postal_code,
42
- country: :country
42
+ country: :country,
43
43
  }
44
44
  end
45
45
  end
@@ -3,7 +3,6 @@ require 'pinpoint/format/parse_error'
3
3
  module Pinpoint
4
4
  class Format
5
5
  class TokenList < Array
6
-
7
6
  ##
8
7
  # Public: Processes each item in the list by removing it and passing it to
9
8
  # the block.
@@ -15,7 +14,7 @@ module Pinpoint
15
14
  # Returns nothing
16
15
  #
17
16
  def process_each!
18
- while size > 0 do
17
+ while size > 0
19
18
  token = delete_at(0)
20
19
 
21
20
  yield token
@@ -30,7 +29,7 @@ module Pinpoint
30
29
  # 'group_start' tokens does not match the number of 'group_end' tokens.
31
30
  #
32
31
  def valid?
33
- raise Pinpoint::Format::UnevenNestingError if group_start_count != group_end_count
32
+ fail Pinpoint::Format::UnevenNestingError if group_start_count != group_end_count
34
33
 
35
34
  true
36
35
  end
@@ -30,7 +30,7 @@ module Pinpoint
30
30
  # Returns nothing
31
31
  #
32
32
  def each
33
- self.tokenable.reset
33
+ tokenable.reset
34
34
 
35
35
  while current_token = next_token
36
36
  yield current_token
@@ -43,7 +43,7 @@ module Pinpoint
43
43
  # Returns a TokenList
44
44
  #
45
45
  def to_token_list
46
- TokenList.new(self.to_a)
46
+ TokenList.new(to_a)
47
47
  end
48
48
 
49
49
  protected
@@ -93,7 +93,7 @@ module Pinpoint
93
93
  left_paren: /%\(/,
94
94
  right_paren: /%\)/,
95
95
  group_start: /\(/,
96
- group_end: /\)/
96
+ group_end: /\)/,
97
97
  }
98
98
  end
99
99
 
@@ -151,20 +151,20 @@ module Pinpoint
151
151
  return if tokenable.eos?
152
152
 
153
153
  case
154
- when text = tokenable.scan(token_map[:literal]); Token.new(:literal, text)
155
- when text = tokenable.scan(token_map[:name]); Token.new(:name, text)
156
- when text = tokenable.scan(token_map[:street]); Token.new(:street, text)
157
- when text = tokenable.scan(token_map[:locality]); Token.new(:locality, text)
158
- when text = tokenable.scan(token_map[:province]); Token.new(:province, text)
159
- when text = tokenable.scan(token_map[:postal_code]); Token.new(:postal_code, text)
160
- when text = tokenable.scan(token_map[:country]); Token.new(:country, text)
161
- when text = tokenable.scan(token_map[:percent]); Token.new(:literal, '%')
162
- when text = tokenable.scan(token_map[:left_paren]); Token.new(:literal, '(')
163
- when text = tokenable.scan(token_map[:right_paren]); Token.new(:literal, ')')
164
- when text = tokenable.scan(token_map[:group_start]); Token.new(:group_start, text)
165
- when text = tokenable.scan(token_map[:group_end]); Token.new(:group_end, text)
154
+ when text = tokenable.scan(token_map[:literal]) then Token.new(:literal, text)
155
+ when text = tokenable.scan(token_map[:name]) then Token.new(:name, text)
156
+ when text = tokenable.scan(token_map[:street]) then Token.new(:street, text)
157
+ when text = tokenable.scan(token_map[:locality]) then Token.new(:locality, text)
158
+ when text = tokenable.scan(token_map[:province]) then Token.new(:province, text)
159
+ when text = tokenable.scan(token_map[:postal_code]) then Token.new(:postal_code, text)
160
+ when text = tokenable.scan(token_map[:country]) then Token.new(:country, text)
161
+ when text = tokenable.scan(token_map[:percent]) then Token.new(:literal, '%')
162
+ when text = tokenable.scan(token_map[:left_paren]) then Token.new(:literal, '(')
163
+ when text = tokenable.scan(token_map[:right_paren]) then Token.new(:literal, ')')
164
+ when text = tokenable.scan(token_map[:group_start]) then Token.new(:group_start, text)
165
+ when text = tokenable.scan(token_map[:group_end]) then Token.new(:group_end, text)
166
166
  else
167
- raise ParseError, "Cannot parse the remainder of the tokenable string: '#{tokenable.rest}'"
167
+ fail ParseError, "Cannot parse the remainder of the tokenable string: '#{tokenable.rest}'"
168
168
  end
169
169
  end
170
170
  end
@@ -2,7 +2,6 @@ require 'pinpoint/format/list'
2
2
 
3
3
  module Pinpoint
4
4
  class Formatter
5
-
6
5
  ##
7
6
  # Public: Is able to process an Address into numerous formats based on the
8
7
  # country and style, or a completely custom format.
@@ -74,7 +73,7 @@ module Pinpoint
74
73
 
75
74
  format = formats[country]
76
75
 
77
- format.output address, :style => style
76
+ format.output address, style: style
78
77
  end
79
78
 
80
79
  private
@@ -5,7 +5,6 @@ require 'pinpoint/mapable_services/mapquest'
5
5
 
6
6
  module Pinpoint
7
7
  module Mapable
8
-
9
8
  ##
10
9
  # Public: Creates a URL which can be used to locate the Mapable on a map
11
10
  # using one of the supported services:
@@ -32,8 +31,8 @@ module Pinpoint
32
31
  service = options.fetch(:via, :google_maps)
33
32
  service_class = service_class_for(service)
34
33
 
35
- service_class.map_url location: self.to_s,
36
- location_name: self.name
34
+ service_class.map_url location: to_s,
35
+ location_name: name
37
36
  end
38
37
 
39
38
  private
@@ -3,7 +3,6 @@ require 'cgi'
3
3
  module Pinpoint
4
4
  module MapableService
5
5
  class GoogleMaps
6
-
7
6
  ##
8
7
  # Private: Renders a URL for a given location and location name using the
9
8
  # Google Maps mapping service.
@@ -3,7 +3,6 @@ require 'cgi'
3
3
  module Pinpoint
4
4
  module MapableService
5
5
  class Mapquest
6
-
7
6
  ##
8
7
  # Private: Renders a URL for a given location and location name using the
9
8
  # Mapquest mapping service.
@@ -3,7 +3,6 @@ require 'cgi'
3
3
  module Pinpoint
4
4
  module MapableService
5
5
  class YahooMaps
6
-
7
6
  ##
8
7
  # Private: Renders a URL for a given location and location name using the
9
8
  # Yahoo Maps mapping service.
@@ -62,7 +62,7 @@ module Pinpoint
62
62
  object.send(:define_method, field_name) do
63
63
  address_fields_and_values = field_pairs.map do |field_pair|
64
64
  [field_pair[0], send(field_pair[1])]
65
- end
65
+ end
66
66
 
67
67
  address_fields_and_values = Hash[address_fields_and_values]
68
68
 
@@ -136,12 +136,12 @@ module Pinpoint
136
136
  gsub(/\A#{prefix}/, '').
137
137
  gsub(/=\z/, '').
138
138
  to_sym
139
- end
139
+ end
140
140
 
141
141
  {
142
142
  base_fields: base_fields,
143
143
  reader_fields: reader_fields,
144
- writer_fields: writer_fields
144
+ writer_fields: writer_fields,
145
145
  }
146
146
  end
147
147
 
@@ -1,3 +1,3 @@
1
1
  module Pinpoint
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
@@ -1,48 +1,48 @@
1
- require 'rspectacular'
1
+ require 'spec_helper'
2
2
  require 'pinpoint/address'
3
3
 
4
4
  describe 'Pinpoint::Address' do
5
5
  let(:address) { Pinpoint::Address.new }
6
6
 
7
- it { address.respond_to?(:region).should be_true }
8
- it { address.respond_to?(:region=).should be_true }
9
- it { address.respond_to?(:province).should be_true }
10
- it { address.respond_to?(:province=).should be_true }
11
- it { address.respond_to?(:locality).should be_true }
12
- it { address.respond_to?(:locality=).should be_true }
13
- it { address.respond_to?(:postal_code).should be_true }
14
- it { address.respond_to?(:postal_code=).should be_true }
15
- it { address.respond_to?(:zip).should be_true }
16
- it { address.respond_to?(:zip=).should be_true }
17
- it { address.respond_to?(:district).should be_true }
18
- it { address.respond_to?(:district=).should be_true }
7
+ it { expect(address.respond_to?(:region)).to eql true }
8
+ it { expect(address.respond_to?(:region=)).to eql true }
9
+ it { expect(address.respond_to?(:province)).to eql true }
10
+ it { expect(address.respond_to?(:province=)).to eql true }
11
+ it { expect(address.respond_to?(:locality)).to eql true }
12
+ it { expect(address.respond_to?(:locality=)).to eql true }
13
+ it { expect(address.respond_to?(:postal_code)).to eql true }
14
+ it { expect(address.respond_to?(:postal_code=)).to eql true }
15
+ it { expect(address.respond_to?(:zip)).to eql true }
16
+ it { expect(address.respond_to?(:zip=)).to eql true }
17
+ it { expect(address.respond_to?(:district)).to eql true }
18
+ it { expect(address.respond_to?(:district=)).to eql true }
19
19
 
20
20
  describe '#new' do
21
21
  context 'when it is passed a set of initial values as a Hash' do
22
22
  let(:address) do
23
23
  Pinpoint::Address.new(
24
- name: 'The Frist Center for the Visual Arts',
25
- street: '919 Broadway',
26
- city: 'Nashville',
27
- state: 'Tennessee',
28
- county: 'Davidson',
29
- zip_code: '37203',
30
- country: 'United States',
31
- latitude: '36.15885623029150',
32
- longitude: '-86.78226636970851'
24
+ name: 'The Frist Center for the Visual Arts',
25
+ street: '919 Broadway',
26
+ city: 'Nashville',
27
+ state: 'Tennessee',
28
+ county: 'Davidson',
29
+ zip_code: '37203',
30
+ country: 'United States',
31
+ latitude: '36.15885623029150',
32
+ longitude: '-86.78226636970851',
33
33
  )
34
34
  end
35
35
 
36
36
  it 'sets its values properly' do
37
- address.name.should eql 'The Frist Center for the Visual Arts'
38
- address.street.should eql '919 Broadway'
39
- address.city.should eql 'Nashville'
40
- address.state.should eql 'Tennessee'
41
- address.county.should eql 'Davidson'
42
- address.zip_code.should eql '37203'
43
- address.country.should eql 'United States'
44
- address.latitude.should eql '36.15885623029150'
45
- address.longitude.should eql '-86.78226636970851'
37
+ expect(address.name).to eql 'The Frist Center for the Visual Arts'
38
+ expect(address.street).to eql '919 Broadway'
39
+ expect(address.city).to eql 'Nashville'
40
+ expect(address.state).to eql 'Tennessee'
41
+ expect(address.county).to eql 'Davidson'
42
+ expect(address.zip_code).to eql '37203'
43
+ expect(address.country).to eql 'United States'
44
+ expect(address.latitude).to eql '36.15885623029150'
45
+ expect(address.longitude).to eql '-86.78226636970851'
46
46
  end
47
47
  end
48
48
  end
@@ -51,64 +51,64 @@ describe 'Pinpoint::Address' do
51
51
  context 'when any of the main parts of the address are blank' do
52
52
  let(:address) do
53
53
  Pinpoint::Address.new(
54
- street: '',
55
- city: 'Nashville',
56
- state: 'Tennessee',
57
- zip_code: '37203',
58
- country: 'US'
54
+ street: '',
55
+ city: 'Nashville',
56
+ state: 'Tennessee',
57
+ zip_code: '37203',
58
+ country: 'US',
59
59
  )
60
60
  end
61
61
 
62
62
  it 'is false' do
63
- address.should_not be_complete
63
+ expect(address).not_to be_complete
64
64
  end
65
65
  end
66
66
 
67
67
  context 'when any of the main parts of the address are missing' do
68
68
  let(:address) do
69
69
  Pinpoint::Address.new(
70
- street: nil,
71
- city: 'Nashville',
72
- state: 'Tennessee',
73
- zip_code: '37203',
74
- country: 'US'
70
+ street: nil,
71
+ city: 'Nashville',
72
+ state: 'Tennessee',
73
+ zip_code: '37203',
74
+ country: 'US',
75
75
  )
76
76
  end
77
77
 
78
78
  it 'is false' do
79
- address.should_not be_complete
79
+ expect(address).not_to be_complete
80
80
  end
81
81
  end
82
82
 
83
83
  context 'when all of the main parts of the address are present' do
84
84
  let(:address) do
85
85
  Pinpoint::Address.new(
86
- street: '919 Broadway',
87
- city: 'Nashville',
88
- state: 'Tennessee',
89
- zip_code: '37203',
90
- country: 'US'
86
+ street: '919 Broadway',
87
+ city: 'Nashville',
88
+ state: 'Tennessee',
89
+ zip_code: '37203',
90
+ country: 'US',
91
91
  )
92
92
  end
93
93
 
94
94
  it 'is true' do
95
- address.should be_complete
95
+ expect(address).to be_complete
96
96
  end
97
97
  end
98
98
 
99
99
  context 'when all of the main parts of the address are missing' do
100
100
  let(:address) do
101
101
  Pinpoint::Address.new(
102
- street: nil,
103
- city: nil,
104
- state: nil,
105
- zip_code: nil,
106
- country: nil
102
+ street: nil,
103
+ city: nil,
104
+ state: nil,
105
+ zip_code: nil,
106
+ country: nil,
107
107
  )
108
108
  end
109
109
 
110
110
  it 'is false' do
111
- address.should_not be_complete
111
+ expect(address).not_to be_complete
112
112
  end
113
113
  end
114
114
  end
@@ -117,64 +117,64 @@ describe 'Pinpoint::Address' do
117
117
  context 'when any of the main parts of the address are blank' do
118
118
  let(:address) do
119
119
  Pinpoint::Address.new(
120
- street: '',
121
- city: 'Nashville',
122
- state: 'Tennessee',
123
- zip_code: '37203',
124
- country: 'US'
120
+ street: '',
121
+ city: 'Nashville',
122
+ state: 'Tennessee',
123
+ zip_code: '37203',
124
+ country: 'US',
125
125
  )
126
126
  end
127
127
 
128
128
  it 'is true' do
129
- address.should be_incomplete
129
+ expect(address).to be_incomplete
130
130
  end
131
131
  end
132
132
 
133
133
  context 'when any of the main parts of the address are missing' do
134
134
  let(:address) do
135
135
  Pinpoint::Address.new(
136
- street: nil,
137
- city: 'Nashville',
138
- state: 'Tennessee',
139
- zip_code: '37203',
140
- country: 'US'
136
+ street: nil,
137
+ city: 'Nashville',
138
+ state: 'Tennessee',
139
+ zip_code: '37203',
140
+ country: 'US',
141
141
  )
142
142
  end
143
143
 
144
144
  it 'is true' do
145
- address.should be_incomplete
145
+ expect(address).to be_incomplete
146
146
  end
147
147
  end
148
148
 
149
149
  context 'when all of the main parts of the address are present' do
150
150
  let(:address) do
151
151
  Pinpoint::Address.new(
152
- street: '919 Broadway',
153
- city: 'Nashville',
154
- state: 'Tennessee',
155
- zip_code: '37203',
156
- country: 'US'
152
+ street: '919 Broadway',
153
+ city: 'Nashville',
154
+ state: 'Tennessee',
155
+ zip_code: '37203',
156
+ country: 'US',
157
157
  )
158
158
  end
159
159
 
160
160
  it 'is false' do
161
- address.should_not be_incomplete
161
+ expect(address).not_to be_incomplete
162
162
  end
163
163
  end
164
164
 
165
165
  context 'when all of the main parts of the address are missing' do
166
166
  let(:address) do
167
167
  Pinpoint::Address.new(
168
- street: nil,
169
- city: nil,
170
- state: nil,
171
- zip_code: nil,
172
- country: nil
168
+ street: nil,
169
+ city: nil,
170
+ state: nil,
171
+ zip_code: nil,
172
+ country: nil,
173
173
  )
174
174
  end
175
175
 
176
176
  it 'is false' do
177
- address.should_not be_incomplete
177
+ expect(address).not_to be_incomplete
178
178
  end
179
179
  end
180
180
  end
@@ -183,64 +183,64 @@ describe 'Pinpoint::Address' do
183
183
  context 'when any of the main parts of the address are blank' do
184
184
  let(:address) do
185
185
  Pinpoint::Address.new(
186
- street: '',
187
- city: 'Nashville',
188
- state: 'Tennessee',
189
- zip_code: '37203',
190
- country: 'US'
186
+ street: '',
187
+ city: 'Nashville',
188
+ state: 'Tennessee',
189
+ zip_code: '37203',
190
+ country: 'US',
191
191
  )
192
192
  end
193
193
 
194
194
  it 'is false' do
195
- address.should_not be_empty
195
+ expect(address).not_to be_empty
196
196
  end
197
197
  end
198
198
 
199
199
  context 'when any of the main parts of the address are missing' do
200
200
  let(:address) do
201
201
  Pinpoint::Address.new(
202
- street: nil,
203
- city: 'Nashville',
204
- state: 'Tennessee',
205
- zip_code: '37203',
206
- country: 'US'
202
+ street: nil,
203
+ city: 'Nashville',
204
+ state: 'Tennessee',
205
+ zip_code: '37203',
206
+ country: 'US',
207
207
  )
208
208
  end
209
209
 
210
210
  it 'is false' do
211
- address.should_not be_empty
211
+ expect(address).not_to be_empty
212
212
  end
213
213
  end
214
214
 
215
215
  context 'when all of the main parts of the address are present' do
216
216
  let(:address) do
217
217
  Pinpoint::Address.new(
218
- street: '919 Broadway',
219
- city: 'Nashville',
220
- state: 'Tennessee',
221
- zip_code: '37203',
222
- country: 'US'
218
+ street: '919 Broadway',
219
+ city: 'Nashville',
220
+ state: 'Tennessee',
221
+ zip_code: '37203',
222
+ country: 'US',
223
223
  )
224
224
  end
225
225
 
226
226
  it 'is false' do
227
- address.should_not be_empty
227
+ expect(address).not_to be_empty
228
228
  end
229
229
  end
230
230
 
231
231
  context 'when all of the main parts of the address are missing' do
232
232
  let(:address) do
233
233
  Pinpoint::Address.new(
234
- street: nil,
235
- city: nil,
236
- state: nil,
237
- zip_code: nil,
238
- country: nil
234
+ street: nil,
235
+ city: nil,
236
+ state: nil,
237
+ zip_code: nil,
238
+ country: nil,
239
239
  )
240
240
  end
241
241
 
242
242
  it 'is true' do
243
- address.should be_empty
243
+ expect(address).to be_empty
244
244
  end
245
245
  end
246
246
  end