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

Fix time-dependent test failure #561

Merged
merged 1 commit into from
Jul 11, 2015

Conversation

avit
Copy link
Contributor

@avit avit commented Jul 9, 2015

When the database has default_timezone = :local (system time) and the Time.zone is set to elsewhere then Date.current does not match what the query produces for the stored timestamps.

Resolved by setting everything to UTC.

jonatack added a commit that referenced this pull request Jul 11, 2015
@jonatack jonatack merged commit f77437e into activerecord-hackery:master Jul 11, 2015
@jonatack
Copy link
Contributor

Thanks @avit!

@jonatack
Copy link
Contributor

Could you update the change log with your fix?

@@ -145,6 +145,9 @@ def self.sane_adapter?
end

it "should function correctly with a multi-parameter attribute" do
::ActiveRecord::Base.default_timezone = :utc
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would have been better to have this in config/environments/test.rb, as this could lead to unexpected behaviour for other specs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... a different TZ is set in spec_helper.rb as well. Suggestion?

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

Successfully merging this pull request may close these issues.

3 participants