Fix time zones in specs #91

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants

Two specs were failing due to the way time zones were being compared.

ruby -v

ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

Gemfile.lock

PATH
  remote: .
  specs:
    validates_timeliness (3.0.14)
      timeliness (~> 0.3.7)

GEM
  remote: http://rubygems.org/
  specs:
    actionmailer (3.2.9)
      actionpack (= 3.2.9)
      mail (~> 2.4.4)
    actionpack (3.2.9)
      activemodel (= 3.2.9)
      activesupport (= 3.2.9)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.0)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    activemodel (3.2.9)
      activesupport (= 3.2.9)
      builder (~> 3.0.0)
    activerecord (3.2.9)
      activemodel (= 3.2.9)
      activesupport (= 3.2.9)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.9)
      activemodel (= 3.2.9)
      activesupport (= 3.2.9)
    activesupport (3.2.9)
      i18n (~> 0.6)
      multi_json (~> 1.0)
    appraisal (0.5.1)
      bundler
      rake
    arel (3.0.2)
    bson (1.8.0)
      activesupport
    bson_ext (1.8.0)
      bson (~> 1.8.0)
    builder (3.0.4)
    columnize (0.3.6)
    debugger (1.2.2)
      columnize (>= 0.3.1)
      debugger-linecache (~> 1.1.1)
      debugger-ruby_core_source (~> 1.1.5)
    debugger-linecache (1.1.2)
      debugger-ruby_core_source (>= 1.1.1)
    debugger-ruby_core_source (1.1.5)
    diff-lcs (1.1.3)
    erubis (2.7.0)
    hike (1.2.1)
    i18n (0.6.1)
    journey (1.0.4)
    json (1.7.5)
    linecache (0.46)
      rbx-require-relative (> 0.0.4)
    mail (2.4.4)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.19)
    mongo (1.8.0)
      bson (~> 1.8.0)
    mongoid (2.3.4)
      activemodel (~> 3.1)
      mongo (~> 1.3)
      tzinfo (~> 0.3.22)
    multi_json (1.4.0)
    nokogiri (1.5.5)
    polyglot (0.3.3)
    rack (1.4.1)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-ssl (1.3.2)
      rack
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (3.2.9)
      actionmailer (= 3.2.9)
      actionpack (= 3.2.9)
      activerecord (= 3.2.9)
      activeresource (= 3.2.9)
      activesupport (= 3.2.9)
      bundler (~> 1.0)
      railties (= 3.2.9)
    railties (3.2.9)
      actionpack (= 3.2.9)
      activesupport (= 3.2.9)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    rake (10.0.2)
    rbx-require-relative (0.0.9)
    rdoc (3.12)
      json (~> 1.4)
    rspec (2.12.0)
      rspec-core (~> 2.12.0)
      rspec-expectations (~> 2.12.0)
      rspec-mocks (~> 2.12.0)
    rspec-core (2.12.1)
    rspec-expectations (2.12.0)
      diff-lcs (~> 1.1.3)
    rspec-mocks (2.12.0)
    rspec-rails (2.12.0)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 2.12.0)
      rspec-expectations (~> 2.12.0)
      rspec-mocks (~> 2.12.0)
    rspec_tag_matchers (1.0.0)
      nokogiri (>= 1.4.0)
      rspec-rails (>= 1.2.6)
    ruby-debug (0.10.4)
      columnize (>= 0.1)
      ruby-debug-base (~> 0.10.4.0)
    ruby-debug-base (0.10.4)
      linecache (>= 0.3)
    sprockets (2.2.2)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sqlite3 (1.3.6)
    sqlite3-ruby (1.3.3)
      sqlite3 (>= 1.3.3)
    system_timer (1.2.4)
    thor (0.16.0)
    tilt (1.3.3)
    timecop (0.5.4)
    timeliness (0.3.7)
    treetop (1.4.12)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.35)

PLATFORMS
  ruby

DEPENDENCIES
  appraisal
  bson_ext
  debugger
  mongoid (~> 2.3.0)
  rails (~> 3.2.6)
  rspec (~> 2.8)
  rspec-rails (~> 2.8)
  rspec_tag_matchers
  ruby-debug
  sqlite3
  sqlite3-ruby
  system_timer
  timecop
  validates_timeliness!

But midnight Australian/Melbourne time, means 14:00 the day before at UTC, so it should be (/2009-12-31 14:00:00/)

Contributor

jarl-dk commented Apr 11, 2013

The interesting part, when fixing the test to correctly verify against the correct UTC time 2009-12-31 14:00:00 the tests fail, but that is not because there is somethiing wrong with the tests, that is because there is something wrong with the code...

However applying the fix in #96 (which solves #85) solves this problem too.

Contributor

jarl-dk commented Jun 16, 2013

@christophermanning Your specs are incorrect (see christophermanning/validates_timeliness@147596b#spec-validates_timeliness-orm-active_record_spec-rb-P5). PR #99 superseeds this PR, but applying #99 by itself reveals problems with the code. However applying #96 will make the tests green again (in every timezone).

Thanks for mentioning, since there is a better PR, I'll close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment