Skip to content

Commit 0dd8867

Browse files
committed
Avoid mixing IceCube into the global namespace
Until specs can be adjusted to reference IceCube objects explicitly, this permits lookup for the commonly used IceCube constants only, without polluting the global Object namespace with all methods and constants from IceCube.
1 parent 73fdfc7 commit 0dd8867

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

spec/examples/occurrence_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
require File.dirname(__FILE__) + '/../spec_helper'
22

3-
include IceCube
4-
53
describe Occurrence do
64

75
it "reports as a Time" do

spec/examples/recur_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
require File.dirname(__FILE__) + '/../spec_helper'
22

3-
include IceCube
4-
53
describe :remaining_occurrences do
64

75
it 'should get the proper remaining occurrences from now' do

spec/spec_helper.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
'Pacific/Auckland', # +1200 / +1300
2020
]
2121

22+
# TODO: enable warnings here and update specs to call IceCube objects correctly
23+
def Object.const_missing(sym)
24+
case sym
25+
when :Schedule, :Rule, :Occurrence, :TimeUtil, :ONE_DAY, :ONE_HOUR, :ONE_MINUTE
26+
# warn "Use IceCube::#{sym}", caller[0]
27+
IceCube.const_get(sym)
28+
else
29+
super
30+
end
31+
end
32+
2233
RSpec.configure do |config|
2334
# Enable flags like --only-failures and --next-failure
2435
config.example_status_persistence_file_path = ".rspec_status"

0 commit comments

Comments
 (0)