area_code_validator 0.0.4 → 0.0.5

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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -5
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +3 -0
  6. data/Gemfile.lock +102 -70
  7. data/README.md +8 -2
  8. data/area_code_validator.gemspec +4 -2
  9. data/lib/area_code_validator/version.rb +1 -1
  10. data/lib/config/area_code_config.rb +11 -11
  11. data/test/{dummy/test/area_code_validator_test.rb → area_code_validator_test.rb} +7 -7
  12. data/test/configuration/database.yml +5 -0
  13. data/test/configuration/schema.rb +7 -0
  14. data/test/{dummy/app/models → models}/phone.rb +0 -0
  15. data/test/{dummy/test/models/phone_test.rb → phone_test.rb} +1 -1
  16. data/test/{dummy/test/test_helper.rb → test_helper.rb} +19 -11
  17. metadata +62 -109
  18. data/test/dummy/README.rdoc +0 -28
  19. data/test/dummy/Rakefile +0 -6
  20. data/test/dummy/app/assets/images/.keep +0 -0
  21. data/test/dummy/app/assets/javascripts/application.js +0 -13
  22. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  23. data/test/dummy/app/controllers/application_controller.rb +0 -5
  24. data/test/dummy/app/controllers/concerns/.keep +0 -0
  25. data/test/dummy/app/helpers/application_helper.rb +0 -2
  26. data/test/dummy/app/mailers/.keep +0 -0
  27. data/test/dummy/app/models/.keep +0 -0
  28. data/test/dummy/app/models/concerns/.keep +0 -0
  29. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  30. data/test/dummy/bin/bundle +0 -3
  31. data/test/dummy/bin/rails +0 -4
  32. data/test/dummy/bin/rake +0 -4
  33. data/test/dummy/config/application.rb +0 -23
  34. data/test/dummy/config/boot.rb +0 -5
  35. data/test/dummy/config/database.yml +0 -25
  36. data/test/dummy/config/environment.rb +0 -5
  37. data/test/dummy/config/environments/development.rb +0 -29
  38. data/test/dummy/config/environments/production.rb +0 -80
  39. data/test/dummy/config/environments/test.rb +0 -36
  40. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  41. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  42. data/test/dummy/config/initializers/inflections.rb +0 -16
  43. data/test/dummy/config/initializers/mime_types.rb +0 -5
  44. data/test/dummy/config/initializers/secret_token.rb +0 -12
  45. data/test/dummy/config/initializers/session_store.rb +0 -3
  46. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  47. data/test/dummy/config/locales/en.yml +0 -23
  48. data/test/dummy/config/routes.rb +0 -56
  49. data/test/dummy/config.ru +0 -4
  50. data/test/dummy/db/migrate/20131025094043_create_phones.rb +0 -14
  51. data/test/dummy/db/schema.rb +0 -23
  52. data/test/dummy/lib/assets/.keep +0 -0
  53. data/test/dummy/log/.keep +0 -0
  54. data/test/dummy/public/404.html +0 -58
  55. data/test/dummy/public/422.html +0 -58
  56. data/test/dummy/public/500.html +0 -57
  57. data/test/dummy/public/favicon.ico +0 -0
  58. data/test/dummy/test/fixtures/phones.yml +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef8404f4778ce96f45515b6e29c55bce4e528a3f
4
- data.tar.gz: 89835be8bddd8a2fe63ce2b46c369ceae8fa4da4
3
+ metadata.gz: 1b54007e087ec7cec4a31bf004ee41989c6f0d9c
4
+ data.tar.gz: 0bf629cfd0fe65e49ff48c52e1d2250ff0b22d0d
5
5
  SHA512:
6
- metadata.gz: d19c2831504cb16fdd948a40a7f83ef2601a69ec0d534adb06c8bcfacc9d4f216964edc19ad7ac14563495653f8b7db9eca97fd904177e3bf861ab902004db8e
7
- data.tar.gz: 09b30321dd74f07ba14acfde3ab2782c2067bc5f94b4bf19acb59e75e3020bf338de25fe182f661efbb23a548cc95bf319d10315aef19f2a9627345fa21437fd
6
+ metadata.gz: 99a087bc485289eae77cd641e3addddbe6c0c5cbf1a96b73f8baa02be863c5a9d34f422c6272079159543f0478ca19b01135ced82868c85cbb78fe9ff5837f77
7
+ data.tar.gz: f913dbf184debd3eb037a2ebe0f26cc1250f11b311afb4b773d8e576bdc029e3f65e9fd99db05d552cb7148733488db63b890c2c8c207f6cca82a52d92951696
data/.gitignore CHANGED
@@ -1,11 +1,7 @@
1
1
  .bundle/
2
2
  log/*.log
3
3
  pkg/
4
- test/dummy/db/*.sqlite3
5
- test/dummy/db/*.sqlite3-journal
6
- test/dummy/log/*.log
7
- test/dummy/tmp/
8
- test/dummy/.sass-cache
4
+ db/*.sqlite3
9
5
  *.gem
10
6
  *.rbc
11
7
  .bundle
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ area-code-validator
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.2.3
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - "2.2.3"
data/Gemfile.lock CHANGED
@@ -1,89 +1,116 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- area_code_validator (0.0.4)
4
+ area_code_validator (0.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actionmailer (4.0.0)
10
- actionpack (= 4.0.0)
11
- mail (~> 2.5.3)
12
- actionpack (4.0.0)
13
- activesupport (= 4.0.0)
14
- builder (~> 3.1.0)
15
- erubis (~> 2.7.0)
16
- rack (~> 1.5.2)
9
+ actionmailer (4.2.5)
10
+ actionpack (= 4.2.5)
11
+ actionview (= 4.2.5)
12
+ activejob (= 4.2.5)
13
+ mail (~> 2.5, >= 2.5.4)
14
+ rails-dom-testing (~> 1.0, >= 1.0.5)
15
+ actionpack (4.2.5)
16
+ actionview (= 4.2.5)
17
+ activesupport (= 4.2.5)
18
+ rack (~> 1.6)
17
19
  rack-test (~> 0.6.2)
18
- activemodel (4.0.0)
19
- activesupport (= 4.0.0)
20
- builder (~> 3.1.0)
21
- activerecord (4.0.0)
22
- activemodel (= 4.0.0)
23
- activerecord-deprecated_finders (~> 1.0.2)
24
- activesupport (= 4.0.0)
25
- arel (~> 4.0.0)
26
- activerecord-deprecated_finders (1.0.3)
27
- activesupport (4.0.0)
28
- i18n (~> 0.6, >= 0.6.4)
29
- minitest (~> 4.2)
30
- multi_json (~> 1.3)
31
- thread_safe (~> 0.1)
32
- tzinfo (~> 0.3.37)
33
- arel (4.0.1)
34
- atomic (1.1.14)
35
- builder (3.1.4)
20
+ rails-dom-testing (~> 1.0, >= 1.0.5)
21
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
22
+ actionview (4.2.5)
23
+ activesupport (= 4.2.5)
24
+ builder (~> 3.1)
25
+ erubis (~> 2.7.0)
26
+ rails-dom-testing (~> 1.0, >= 1.0.5)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
+ activejob (4.2.5)
29
+ activesupport (= 4.2.5)
30
+ globalid (>= 0.3.0)
31
+ activemodel (4.2.5)
32
+ activesupport (= 4.2.5)
33
+ builder (~> 3.1)
34
+ activerecord (4.2.5)
35
+ activemodel (= 4.2.5)
36
+ activesupport (= 4.2.5)
37
+ arel (~> 6.0)
38
+ activesupport (4.2.5)
39
+ i18n (~> 0.7)
40
+ json (~> 1.7, >= 1.7.7)
41
+ minitest (~> 5.1)
42
+ thread_safe (~> 0.3, >= 0.3.4)
43
+ tzinfo (~> 1.1)
44
+ ansi (1.5.0)
45
+ arel (6.0.3)
46
+ builder (3.2.2)
47
+ concurrent-ruby (1.0.0)
36
48
  erubis (2.7.0)
37
- hike (1.2.3)
38
- i18n (0.6.5)
39
- mail (2.5.4)
40
- mime-types (~> 1.16)
41
- treetop (~> 1.4.8)
42
- mime-types (1.25)
43
- minitest (4.7.5)
44
- multi_json (1.8.2)
45
- polyglot (0.3.3)
46
- rack (1.5.2)
47
- rack-test (0.6.2)
49
+ globalid (0.3.6)
50
+ activesupport (>= 4.1.0)
51
+ i18n (0.7.0)
52
+ json (1.8.3)
53
+ loofah (2.0.3)
54
+ nokogiri (>= 1.5.9)
55
+ mail (2.6.3)
56
+ mime-types (>= 1.16, < 3)
57
+ mime-types (2.99)
58
+ mini_portile2 (2.0.0)
59
+ minitest (5.8.3)
60
+ minitest-reporters (1.1.7)
61
+ ansi
62
+ builder
63
+ minitest (>= 5.0)
64
+ ruby-progressbar
65
+ nokogiri (1.6.7.1)
66
+ mini_portile2 (~> 2.0.0.rc2)
67
+ rack (1.6.4)
68
+ rack-test (0.6.3)
48
69
  rack (>= 1.0)
49
- rails (4.0.0)
50
- actionmailer (= 4.0.0)
51
- actionpack (= 4.0.0)
52
- activerecord (= 4.0.0)
53
- activesupport (= 4.0.0)
70
+ rails (4.2.5)
71
+ actionmailer (= 4.2.5)
72
+ actionpack (= 4.2.5)
73
+ actionview (= 4.2.5)
74
+ activejob (= 4.2.5)
75
+ activemodel (= 4.2.5)
76
+ activerecord (= 4.2.5)
77
+ activesupport (= 4.2.5)
54
78
  bundler (>= 1.3.0, < 2.0)
55
- railties (= 4.0.0)
56
- sprockets-rails (~> 2.0.0)
57
- railties (4.0.0)
58
- actionpack (= 4.0.0)
59
- activesupport (= 4.0.0)
79
+ railties (= 4.2.5)
80
+ sprockets-rails
81
+ rails-deprecated_sanitizer (1.0.3)
82
+ activesupport (>= 4.2.0.alpha)
83
+ rails-dom-testing (1.0.7)
84
+ activesupport (>= 4.2.0.beta, < 5.0)
85
+ nokogiri (~> 1.6.0)
86
+ rails-deprecated_sanitizer (>= 1.0.1)
87
+ rails-html-sanitizer (1.0.2)
88
+ loofah (~> 2.0)
89
+ railties (4.2.5)
90
+ actionpack (= 4.2.5)
91
+ activesupport (= 4.2.5)
60
92
  rake (>= 0.8.7)
61
93
  thor (>= 0.18.1, < 2.0)
62
- rake (10.1.0)
94
+ rake (10.4.2)
95
+ ruby-progressbar (1.7.5)
63
96
  shoulda (3.5.0)
64
97
  shoulda-context (~> 1.0, >= 1.0.1)
65
98
  shoulda-matchers (>= 1.4.1, < 3.0)
66
- shoulda-context (1.1.5)
67
- shoulda-matchers (2.4.0)
99
+ shoulda-context (1.2.1)
100
+ shoulda-matchers (2.8.0)
68
101
  activesupport (>= 3.0.0)
69
- sprockets (2.10.0)
70
- hike (~> 1.2)
71
- multi_json (~> 1.0)
72
- rack (~> 1.0)
73
- tilt (~> 1.1, != 1.3.0)
74
- sprockets-rails (2.0.1)
75
- actionpack (>= 3.0)
76
- activesupport (>= 3.0)
77
- sprockets (~> 2.8)
78
- sqlite3 (1.3.8)
79
- thor (0.18.1)
80
- thread_safe (0.1.3)
81
- atomic
82
- tilt (1.4.1)
83
- treetop (1.4.15)
84
- polyglot
85
- polyglot (>= 0.3.1)
86
- tzinfo (0.3.38)
102
+ sprockets (3.5.2)
103
+ concurrent-ruby (~> 1.0)
104
+ rack (> 1, < 3)
105
+ sprockets-rails (3.0.0)
106
+ actionpack (>= 4.0)
107
+ activesupport (>= 4.0)
108
+ sprockets (>= 3.0.0)
109
+ sqlite3 (1.3.11)
110
+ thor (0.19.1)
111
+ thread_safe (0.3.5)
112
+ tzinfo (1.2.2)
113
+ thread_safe (~> 0.1)
87
114
 
88
115
  PLATFORMS
89
116
  ruby
@@ -91,7 +118,12 @@ PLATFORMS
91
118
  DEPENDENCIES
92
119
  area_code_validator!
93
120
  bundler (~> 1.3)
94
- rails (~> 4.0.0)
121
+ minitest
122
+ minitest-reporters
123
+ rails (~> 4.2.0)
95
124
  rake
96
125
  shoulda
97
126
  sqlite3
127
+
128
+ BUNDLED WITH
129
+ 1.11.2
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/amedeiros/area_code_validator.svg)](https://travis-ci.org/amedeiros/area_code_validator)
2
+
1
3
  # Area Code Validator
2
4
 
3
5
  Area Code Validator is a small gem that validates a phone numbers area code to a state.
@@ -49,6 +51,10 @@ validates :work_phone, :florida_state, area_code_invalid: true
49
51
  4. Push to the branch (`git push origin my-new-feature`)
50
52
  5. Create new Pull Request
51
53
 
52
- ## Future
54
+ ## Author
55
+
56
+ Andrew Medeiros, andrew@amedeiros.com, @_AndrewMedeiros
57
+
58
+ ## Contributors
53
59
 
54
- Include an active model validation.
60
+ [jtwhittington](https://github.com/jtwhittington)
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = 'area_code_validator'
8
8
  spec.version = AreaCodeValidator::VERSION
9
9
  spec.authors = ['Andrew Medeiros']
10
- spec.email = ['amedeiros0920@gmail.com']
10
+ spec.email = ['andrew@amedeiros.com']
11
11
  spec.description = %q{AreaCodeValidator is a small gem that validates a phone numbers area code to a state.}
12
12
  spec.summary = %q{AreaCodeValidator is a small gem that validates a phone numbers area code to a state.}
13
13
  spec.homepage = ''
@@ -18,7 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency 'rails', '~> 4.0.0'
21
+ spec.add_development_dependency 'minitest'
22
+ spec.add_development_dependency 'minitest-reporters'
23
+ spec.add_development_dependency 'rails', '~> 4.2.0'
22
24
  spec.add_development_dependency 'sqlite3'
23
25
  spec.add_development_dependency 'bundler', '~> 1.3'
24
26
  spec.add_development_dependency 'rake'
@@ -1,3 +1,3 @@
1
1
  module AreaCodeValidator
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -62,9 +62,9 @@ module AreaCodeValidator
62
62
  'AK' => ['907'],
63
63
  'AZ' => ['480', '520', '602', '623', '928'],
64
64
  'AR' => ['479', '501', '870'],
65
- 'CA' => ['209', '213', '310', '323', '408', '415', '424', '442', '510', '530', '559', '562', '619', '626', '650', '657', '661', '707', '714', '747', '760', '805', '818', '831', '858', '909', '916', '925', '949', '951'],
65
+ 'CA' => ['209', '213', '310', '323', '408', '415', '424', '442', '510', '530', '559', '562', '619', '626', '628', '650', '657', '661', '707', '714', '747', '760', '805', '818', '831', '858', '909', '916', '925', '949', '951'],
66
66
  'CO' => ['303', '719', '720', '970'],
67
- 'CT' => ['203', '475', '860'],
67
+ 'CT' => ['203', '475', '860', '959'],
68
68
  'DE' => ['302'],
69
69
  'DC' => ['202'],
70
70
  'FL' => ['239', '305', '321', '352', '386', '407', '561', '727', '754', '772', '786', '813', '850', '863', '904', '941', '954'],
@@ -72,10 +72,10 @@ module AreaCodeValidator
72
72
  'HI' => ['808'],
73
73
  'ID' => ['208'],
74
74
  'IL' => ['217', '224', '309', '312', '331', '618', '630', '708', '773', '779', '815', '847', '872'],
75
- 'IN' => ['219', '260', '317', '574', '765', '812'],
75
+ 'IN' => ['219', '260', '317', '463', '574', '765', '812', '930'],
76
76
  'IA' => ['319', '515', '563', '641', '712'],
77
77
  'KS' => ['316', '620', '785', '913'],
78
- 'KY' => ['270', '502', '606', '859'],
78
+ 'KY' => ['270', '364', '502', '606', '859'],
79
79
  'LA' => ['225', '318', '337', '504', '985'],
80
80
  'ME' => ['207'],
81
81
  'MD' => ['240', '301', '410', '443'],
@@ -86,23 +86,23 @@ module AreaCodeValidator
86
86
  'MO' => ['314', '417', '573', '636', '660', '816'],
87
87
  'MT' => ['406'],
88
88
  'NE' => ['308', '402'],
89
- 'NV' => ['702', '775'],
89
+ 'NV' => ['702', '725', '775'],
90
90
  'NH' => ['603'],
91
91
  'NJ' => ['201', '551', '609', '732', '848', '856', '862', '908', '973'],
92
- 'NY' => ['212', '315', '347', '516', '518', '585', '607', '631', '646', '716', '718', '845', '914', '917', '929'],
92
+ 'NY' => ['212', '315', '347', '516', '518', '585', '607', '631', '646', '680', '716', '718', '845', '914', '917', '929', '934'],
93
93
  'NM' => ['505', '575'],
94
- 'NC' => ['252', '336', '704', '828', '910', '919', '980'],
94
+ 'NC' => ['252', '336', '704', '743', '828', '910', '919', '980'],
95
95
  'ND' => ['701'],
96
- 'OH' => ['216', '234', '330', '419', '440', '513', '567', '614', '740', '937'],
96
+ 'OH' => ['216', '220', '234', '330', '380', '419', '440', '513', '567', '614', '740', '937'],
97
97
  'OK' => ['405', '539', '580', '918'],
98
98
  'OR' => ['458', '503', '541', '971'],
99
99
  'PA' => ['215', '267', '412', '484', '570', '610', '717', '724', '814', '878'],
100
100
  'PR' => ['787', '939'],
101
101
  'RI' => ['401'],
102
- 'SC' => ['803', '843', '864'],
102
+ 'SC' => ['803', '843', '854', '864'],
103
103
  'SD' => ['605'],
104
- 'TN' => ['423', '615', '731', '865', '901', '931'],
105
- 'TX' => ['210', '214', '254', '281', '325', '361', '409', '430', '432', '469', '512', '682', '713', '806', '817', '830', '832', '903', '915', '936', '940', '956', '972', '979'],
104
+ 'TN' => ['423', '615', '629', '731', '865', '901', '931'],
105
+ 'TX' => ['210', '214', '254', '281', '325', '346', '361', '409', '430', '432', '469', '512', '682', '713', '806', '817', '830', '832', '903', '915', '936', '940', '956', '972', '979'],
106
106
  'UT' => ['385', '435', '801'],
107
107
  'VT' => ['802'],
108
108
  'VI' => ['340'],
@@ -1,10 +1,10 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
 
3
- class AreaCodeValidatorTest < Test::Unit::TestCase
3
+ class AreaCodeValidatorTest < ActiveSupport::TestCase
4
4
  context AreaCodeValidator do
5
5
  context '.invalid?' do
6
6
 
7
- Helper::VALID_AREA_CODES.each do |state, area_codes_array|
7
+ VALID_AREA_CODES.each do |state, area_codes_array|
8
8
  area_codes_array.each_with_index do |area_code, index|
9
9
  should "be a valid area code #{area_code} - #{state} index: #{index}" do
10
10
  assert !AreaCodeValidator.invalid?(area_code, state), state.inspect + ' ' + area_code.inspect
@@ -12,7 +12,7 @@ class AreaCodeValidatorTest < Test::Unit::TestCase
12
12
  end
13
13
  end
14
14
 
15
- Helper::VALID_AREA_CODES.each do |state, area_codes_array|
15
+ VALID_AREA_CODES.each do |state, area_codes_array|
16
16
  area_codes_array.each_with_index do |area_code, index|
17
17
  should "not be a valid area_code #{area_code} - #{state} index: #{index}" do
18
18
  assert AreaCodeValidator.invalid?(area_code + '123', state), state.inspect + ' ' + area_code + '123'
@@ -32,12 +32,12 @@ class AreaCodeValidatorTest < Test::Unit::TestCase
32
32
 
33
33
  should 'handle a state abbreviation with non-word characters' do
34
34
  state = '12}3 F (** __)L @ 5674``' # FL
35
- assert !AreaCodeValidator.invalid?(Helper::VALID_AREA_CODES['FL'].first, state)
35
+ assert !AreaCodeValidator.invalid?(VALID_AREA_CODES['FL'].first, state)
36
36
  end
37
37
 
38
38
  should 'handle a full state name with non-word characters' do
39
39
  state = '12_3 F (** )L o # R ^ I !!!! DA @ 907' # FLORIDA
40
- assert !AreaCodeValidator.invalid?(Helper::VALID_AREA_CODES['FL'].first, state)
40
+ assert !AreaCodeValidator.invalid?(VALID_AREA_CODES['FL'].first, state)
41
41
  end
42
42
 
43
43
  should 'handle a state area_code with non-word characters and word characters' do
@@ -63,7 +63,7 @@ class AreaCodeValidatorTest < Test::Unit::TestCase
63
63
  end
64
64
 
65
65
  context '.invalid?' do
66
- Helper::VALID_AREA_CODES.each do |state, area_codes_array|
66
+ VALID_AREA_CODES.each do |state, area_codes_array|
67
67
  area_codes_array.each_with_index do |area_code, index|
68
68
  should "be a valid area code #{area_code} - #{state} index: #{index}" do
69
69
  assert AreaCodeValidator.valid?(area_code, state), state.inspect + ' ' + area_code.inspect
@@ -71,7 +71,7 @@ class AreaCodeValidatorTest < Test::Unit::TestCase
71
71
  end
72
72
  end
73
73
 
74
- Helper::VALID_AREA_CODES.each do |state, area_codes_array|
74
+ VALID_AREA_CODES.each do |state, area_codes_array|
75
75
  area_codes_array.each_with_index do |area_code, index|
76
76
  should "not be a valid area_code #{area_code} - #{state} index: #{index}" do
77
77
  refute AreaCodeValidator.valid?(area_code + '123', state), state.inspect + ' ' + area_code + '123'
@@ -0,0 +1,5 @@
1
+ test:
2
+ adapter: sqlite3
3
+ database: db/test.sqlite3
4
+ pool: 5
5
+ timeout: 5000
@@ -0,0 +1,7 @@
1
+ ActiveRecord::Schema.define do
2
+ create_table 'phones', force: true do |t|
3
+ t.string 'cell_phone'
4
+ t.string 'state'
5
+ t.timestamps null: false
6
+ end
7
+ end
File without changes
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
 
3
3
  class PhoneTest < ActiveSupport::TestCase
4
4
  context 'active model validator' do
@@ -1,23 +1,31 @@
1
1
  # Configure Rails Environment
2
2
  ENV['RAILS_ENV'] = 'test'
3
3
 
4
- require File.expand_path('../../config/environment.rb', __FILE__)
5
- require 'rails/test_help'
6
- require 'test/unit'
4
+ require 'rails'
5
+ require 'active_record'
6
+ require 'active_support'
7
+ require 'minitest/autorun'
8
+ require 'minitest/reporters'
7
9
  require 'area_code_validator'
8
10
  require 'shoulda'
9
11
 
10
- Rails.backtrace_cleaner.remove_silencers!
12
+ ActiveSupport.test_order = :sorted
13
+ Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
11
14
 
12
- # Load support files
13
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
14
-
15
- # Load fixtures from the engine
16
- if ActiveSupport::TestCase.method_defined?(:fixture_path=)
17
- ActiveSupport::TestCase.fixture_path = File.expand_path('../fixtures', __FILE__)
15
+ configuration = Pathname.new File.expand_path('configuration', File.dirname(__FILE__))
16
+ models = Pathname.new File.expand_path('models', File.dirname(__FILE__))
17
+ Dir.glob(models.join('*.rb')).each do |file|
18
+ autoload File.basename(file).chomp('.rb').camelcase.intern, file
19
+ end.each do |file|
20
+ require file
18
21
  end
19
22
 
20
- class Helper
23
+ # Setup ActiveRecord
24
+ ActiveRecord::Base.configurations = YAML.load_file configuration.join('database.yml')
25
+ ActiveRecord::Base.establish_connection
26
+ load configuration.join('schema.rb')
27
+
28
+ class ActiveSupport::TestCase
21
29
  VALID_AREA_CODES = {
22
30
  'AL' => ['205', '251', '256', '334', '938'],
23
31
  'AK' => ['907'],