diff --git a/Gemfile b/Gemfile index c308836..277ad5d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,9 +1,9 @@ source "http://rubygems.org" -gem 'debugger', '~> 1.2.0' +#gem 'debugger', '~> 1.2.0' gem 'rspec' -gem "guard", '~> 1.3.2' -gem 'guard-rspec', '~> 1.2.1' -gem 'guard-spork', '~> 1.1.0' -gem 'rb-fsevent', '~> 0.9.1' -gem 'active_support' +gem "guard" +gem 'guard-rspec' +gem 'guard-spork' +gem 'rb-fsevent' +gem 'activesupport' diff --git a/Gemfile.lock b/Gemfile.lock index e190bb7..651fab7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,47 +1,87 @@ GEM remote: http://rubygems.org/ specs: - active_support (3.0.0) - activesupport (= 3.0.0) - activesupport (3.0.0) - columnize (0.3.6) - debugger (1.2.0) - columnize (>= 0.3.1) - debugger-linecache (~> 1.1.1) - debugger-ruby_core_source (~> 1.1.3) - debugger-linecache (1.1.2) - debugger-ruby_core_source (>= 1.1.1) - debugger-ruby_core_source (1.1.3) - diff-lcs (1.1.3) - guard (1.3.2) - listen (>= 0.4.2) - thor (>= 0.14.6) - guard-rspec (1.2.1) - guard (>= 1.1) - guard-spork (1.1.0) - guard (>= 1.1) + activesupport (4.2.5) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + childprocess (0.5.8) + ffi (~> 1.0, >= 1.0.11) + coderay (1.1.0) + diff-lcs (1.2.5) + ffi (1.9.10) + formatador (0.2.5) + guard (2.13.0) + formatador (>= 0.2.4) + listen (>= 2.7, <= 4.0) + lumberjack (~> 1.0) + nenv (~> 0.1) + notiffany (~> 0.0) + pry (>= 0.9.12) + shellany (~> 0.0) + thor (>= 0.18.1) + guard-compat (1.2.1) + guard-rspec (4.6.4) + guard (~> 2.1) + guard-compat (~> 1.1) + rspec (>= 2.99.0, < 4.0) + guard-spork (2.1.0) + childprocess (>= 0.2.3) + guard (~> 2.0) + guard-compat (~> 1.0) spork (>= 0.8.4) - listen (0.5.0) - rb-fsevent (0.9.1) - rspec (2.11.0) - rspec-core (~> 2.11.0) - rspec-expectations (~> 2.11.0) - rspec-mocks (~> 2.11.0) - rspec-core (2.11.1) - rspec-expectations (2.11.3) - diff-lcs (~> 1.1.3) - rspec-mocks (2.11.2) - spork (1.0.0rc3) - thor (0.16.0) + i18n (0.7.0) + json (1.8.3) + listen (3.0.5) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + lumberjack (1.0.9) + method_source (0.8.2) + minitest (5.8.3) + nenv (0.2.0) + notiffany (0.0.8) + nenv (~> 0.1) + shellany (~> 0.0) + pry (0.10.3) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + rb-fsevent (0.9.6) + rb-inotify (0.9.5) + ffi (>= 0.5.0) + rspec (3.4.0) + rspec-core (~> 3.4.0) + rspec-expectations (~> 3.4.0) + rspec-mocks (~> 3.4.0) + rspec-core (3.4.1) + rspec-support (~> 3.4.0) + rspec-expectations (3.4.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.4.0) + rspec-mocks (3.4.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.4.0) + rspec-support (3.4.1) + shellany (0.0.1) + slop (3.6.0) + spork (0.9.2) + thor (0.19.1) + thread_safe (0.3.5) + tzinfo (1.2.2) + thread_safe (~> 0.1) PLATFORMS ruby DEPENDENCIES - active_support - debugger (~> 1.2.0) - guard (~> 1.3.2) - guard-rspec (~> 1.2.1) - guard-spork (~> 1.1.0) - rb-fsevent (~> 0.9.1) + activesupport + guard + guard-rspec + guard-spork + rb-fsevent rspec + +BUNDLED WITH + 1.10.6 diff --git a/lib/tzip/values/central.rb b/lib/tzip/values/central.rb index a32bda6..faa36c8 100644 --- a/lib/tzip/values/central.rb +++ b/lib/tzip/values/central.rb @@ -1,7 +1,8 @@ module TZip - ZONINGS[:central] = %w{35 36 370 3720 3723 381 383 39 } + ZONINGS[:central] = %w{35 36 370 3720 3723 381 383 384 39 } ZONINGS[:central] += %w{4641} ZONINGS[:central] += %w{50 51 52 53 54 55 56 57 581 582 585 } ZONINGS[:central] += %w{60 61 62 63 64 65 660 661 6660 672 680 681 685} ZONINGS[:central] += %w{7} + end diff --git a/lib/tzip/values/eastern.rb b/lib/tzip/values/eastern.rb index 7888356..a6a7989 100644 --- a/lib/tzip/values/eastern.rb +++ b/lib/tzip/values/eastern.rb @@ -1,6 +1,6 @@ module TZip ZONINGS[:eastern] = %w{0 1 2} ZONINGS[:eastern] += %w{30 31 32 33 34 376 379 398 399} - ZONINGS[:eastern] += %w{402 405 410 43 44 45 460 462 462 480 481 482 483 485 488 489 490 495 496 } + ZONINGS[:eastern] += %w{402 405 410 43 44 45 460 462 462 480 481 482 483 484 485 488 489 490 492 495 496 } ZONINGS[:eastern] += %w{569} end diff --git a/lib/tzip/version.rb b/lib/tzip/version.rb index 11b7d0c..6f822d0 100644 --- a/lib/tzip/version.rb +++ b/lib/tzip/version.rb @@ -1,3 +1,3 @@ module TZip - VERSION = "0.0.4" unless defined?(::TZip::VERSION) + VERSION = "0.0.7" unless defined?(::TZip::VERSION) end diff --git a/readme.md b/readme.md index 0c00206..0af3edc 100644 --- a/readme.md +++ b/readme.md @@ -2,6 +2,8 @@ TZip makes it a little bit easier to set TimeZones in a rails app, since it can figure out the appropriate identifier from a ZIP code. +[ ![Codeship Status for chiron-health/TZip](https://codeship.com/projects/ff254ae0-818e-0133-f841-224be51da39b/status?branch=master)](https://codeship.com/projects/121276) + ## Install & Implement ## $ gem install tzip @@ -13,4 +15,4 @@ TZip makes it a little bit easier to set TimeZones in a rails app, since it can # Set the default time zone for a Rails app # Rails configuration file (config/application.rb or config/environments/development.rb, etc) - config.time_zone = ActiveSupport::TimeZone.find_by_zipcode('90210') \ No newline at end of file + config.time_zone = ActiveSupport::TimeZone.find_by_zipcode('90210') diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 69ff34d..f2d7f50 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,6 @@ require 'rubygems' require 'spork' -require 'spork/ext/ruby-debug' +#require 'spork/ext/ruby-debug' require 'active_support' require 'rspec' diff --git a/spec/tzip_spec.rb b/spec/tzip_spec.rb index 8756142..0ee730a 100644 --- a/spec/tzip_spec.rb +++ b/spec/tzip_spec.rb @@ -1,6 +1,5 @@ require "spec_helper" describe TZip do - # Alaska %w(99615 99615 99927).each{|zip| it { print zip; lookup_zip(zip).should == 'Alaska' } @@ -17,7 +16,7 @@ } # Eastern - %w(00926 08701 11226 23464 28269 30043 30044 48201 48109 32308 37604 37917 32207 32216 41017 40502 46032 48124 48197 48307 48532 48912 49008 49546 49684 48503 ).each{|zip| + %w(00926 08701 11226 23464 28269 30043 30044 48201 48109 32308 37604 37917 32207 32216 41017 40502 46032 48124 48197 48307 48532 48912 49008 49546 49684 48503 49242).each{|zip| it { print zip; lookup_zip(zip).should == 'Eastern Time (US & Canada)' } } @@ -36,4 +35,25 @@ it { print zip; lookup_zip(zip).should == 'Pacific Time (US & Canada)' } } + describe '.find_by_zipcode' do + context 'Tennessee' do + let(:zips) { %w(38464) } + let(:timezone) { 'Central Time (US & Canada)' } + it 'matches Central Time (US & Canada)' do + zips.each do |zip| + expect(lookup_zip(zip)).to eq timezone + end + end + end + + context 'Michigan' do + let(:zips) { %w(48439) } + let(:timezone) { 'Eastern Time (US & Canada)' } + it 'matches Eastern Time' do + zips.each do |zip| + expect(lookup_zip(zip)).to eq(timezone), zip + end + end + end + end end