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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions spec/ransack/adapters/active_record/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Time.zone = 'UTC'
Copy link

Choose a reason for hiding this comment

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

Normally, if just temporary, a Time.use_zone block around the related code might have been better - here also to avoid unexpected behaviour other places in the test suite.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would you like to make a PR?


date = Date.current
s = Person.ransack(
{ "created_at_gteq(1i)" => date.year,
Expand Down