Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a top level eager_load! method for Rails compatibility.
Allows TZInfo to be eager loaded in Rails with: config.eager_load_namespaces << TZInfo Calls the eager_load! method (renamed from preload!) of the currently selected DataSource.
- Loading branch information
Showing
4 changed files
with
43 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# encoding: UTF-8 | ||
# frozen_string_literal: true | ||
|
||
require_relative 'test_utils' | ||
|
||
class TCTZInfo < Minitest::Test | ||
def test_eager_load | ||
test_data_source = Minitest::Mock.new | ||
test_data_source.expect(:kind_of?, true, [DataSource]) | ||
test_data_source.expect(:eager_load!, nil) | ||
|
||
orig_data_source = DataSource.get | ||
DataSource.set(test_data_source) | ||
begin | ||
assert_nil(TZInfo.eager_load!) | ||
test_data_source.verify | ||
ensure | ||
DataSource.set(orig_data_source) | ||
end | ||
end | ||
end |