Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing datetime tests #19

Closed
jamiecobbett opened this issue May 4, 2011 · 3 comments
Closed

Failing datetime tests #19

jamiecobbett opened this issue May 4, 2011 · 3 comments

Comments

@jamiecobbett
Copy link

I'm trying to verify and fix an unrelated bug.

I tried running the tests for mysql and sqlite3, and got these 2 errors:

  1) Error:
test: #import importing a datetime field should import a date with MM/DD/YYYY format just fine(#<Class:0x000001016fc910>):
ArgumentError: invalid date
    /Users/jamie/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/core_ext/string/conversions.rb:44:in `to_date'
    test/import_test.rb:239:in `block (3 levels) in <top (required)>'
    /Users/jamie/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/testing/setup_and_teardown.rb:35:in `block in run'
    /Users/jamie/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:418:in `_run_setup_callbacks'
    /Users/jamie/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/testing/setup_and_teardown.rb:34:in `run'

  2) Error:
test: #import importing a datetime field should import a date with YYYY/MM/DD format just fine(#<Class:0x000001016fc910>):
ArgumentError: invalid date
    /Users/jamie/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/core_ext/string/conversions.rb:44:in `to_date'
    test/import_test.rb:244:in `block (3 levels) in <top (required)>'
    /Users/jamie/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/testing/setup_and_teardown.rb:35:in `block in run'
    /Users/jamie/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:418:in `_run_setup_callbacks'
    /Users/jamie/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/testing/setup_and_teardown.rb:34:in `run'

Trying this in Rails console gives a "ArgumentError: invalid date":
"05/14/2010".to_date

I'm in the UK, so maybe there's some difference in locale setting that means it passes for you?

Ruby 1.9.2, Rails 3.0.1, bundler 1.0.11, CentOS & OS X.

@zdennis
Copy link
Owner

zdennis commented May 4, 2011

It looks like its a 1.9.x issue. It runs fine under 1.8.7, but fails with the error you listed under 1.9.x.

@zdennis
Copy link
Owner

zdennis commented May 4, 2011

It looks like date/time parsing in Ruby 1.9.x no longer supports MM/DD/YYYY format. I don't think activerecord-import should do anything special to import dates, so I'm going to remove the example for MM/DD/YYYY and update the other example to use YYYY/MM/DD.

@zdennis
Copy link
Owner

zdennis commented May 4, 2011

This has been pushed to master. All of the examples should be green under Ruby 1.9.2. Thanks for reporting this.

@zdennis zdennis closed this as completed May 4, 2011
bharthur pushed a commit to bharthur/active_import that referenced this issue Apr 24, 2014
…the Date.parse capabilities to no longer support MM/DD/YYYY functionality so we only test against YYYY/MM/DD.

[fixes zdennis/activerecord-import#19]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants