Skip to content

Commit ad78f09

Browse files
committed
Fix specs
1 parent 60327b0 commit ad78f09

File tree

5 files changed

+8
-23
lines changed

5 files changed

+8
-23
lines changed

spec/examples/_no_active_support_spec.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
# ActiveSupport gets loaded by other specs.
55

66
module IceCube
7-
describe TimeUtil, :if_active_support_time => false do
7+
describe TimeUtil do
88

99
before do
10-
expect_any_instance_of(Time).to receive(:respond_to?).with(:time_zone).
11-
at_least(1).times.and_return(false)
10+
raise 'ActiveSupport should not be loaded' if defined?(ActiveSuppport)
1211
end
1312

1413
WORLD_TIME_ZONES.each do |zone|

spec/examples/schedule_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@
757757
expect(schedule.occurs_on?(Time.new(2010, 7, 3, 0, 0, 1, "+11:15"))).to be_falsey
758758
end
759759

760-
specify 'should determine if it occurs on the day of a given ActiveSupport::Time', :if_active_support_time => true do
760+
specify 'should determine if it occurs on the day of a given ActiveSupport::Time' do
761761
Time.zone = "Pacific/Honolulu"
762762
expect(schedule.occurs_on?(Time.zone.parse('2010-07-01 23:59:59'))).to be_falsey
763763
expect(schedule.occurs_on?(Time.zone.parse('2010-07-02 00:00:01'))).to be_truthy
@@ -784,7 +784,7 @@
784784
include_examples 'occurring on a given day'
785785
end
786786

787-
context 'starting from an ActiveSupport::Time', :if_active_support_time => true do
787+
context 'starting from an ActiveSupport::Time' do
788788
let(:start_time) { Time.new(2010, 7, 2, 10, 0, 0, '-07:00').in_time_zone('America/Vancouver') }
789789
include_examples 'occurring on a given day'
790790
end

spec/examples/to_s_es_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@
137137
end
138138

139139
it 'should work with a single rrule' do
140-
pending 'remove dependency'
141140
schedule = IceCube::Schedule.new Time.local(2010, 3, 20)
142141
schedule.add_recurrence_rule IceCube::Rule.weekly.day_of_week(:monday => [1])
143142
expect(schedule.to_s).to eq(schedule.rrules[0].to_s)
@@ -154,9 +153,8 @@
154153
end
155154

156155
it 'should be able to say the second to last monday of the month' do
157-
pending 'penultimo'
158156
rule_str = IceCube::Rule.monthly.day_of_week(:thursday => [-2]).to_s
159-
expect(rule_str).to eq('Mensualmente del segundo al último Jueves del mes')
157+
expect(rule_str).to eq('Mensualmente en el penúltimo Jueves')
160158
end
161159

162160
it 'should be able to say the days of the month something happens' do

spec/examples/to_yaml_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ module IceCube
144144

145145
# This test will fail when not run in Eastern Time
146146
# This is a bug because to_datetime will always convert to system local time
147-
it 'should be able to roll forward times and get back times in an array - TimeWithZone', :if_active_support_time => true do
147+
it 'should be able to roll forward times and get back times in an array - TimeWithZone' do
148148
Time.zone = "Eastern Time (US & Canada)"
149149
start_time = Time.zone.local(2011, 11, 5, 12, 0, 0)
150150
schedule = Schedule.new(start_time)

spec/spec_helper.rb

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,6 @@
2323

2424
config.include WarningHelpers
2525

26-
config.around :each, :if_active_support_time => true do |example|
27-
example.run if defined? ActiveSupport
28-
end
29-
30-
config.around :each, :if_active_support_time => false do |example|
31-
unless defined? ActiveSupport
32-
stubbed_active_support = ::ActiveSupport = Module.new
33-
example.run
34-
Object.send :remove_const, :ActiveSupport
35-
end
36-
end
37-
3826
config.around :each do |example|
3927
if zone = example.metadata[:system_time_zone]
4028
@orig_zone = ENV['TZ']
@@ -46,8 +34,8 @@
4634
end
4735
end
4836

49-
config.before :each do
50-
if time_args = @example.metadata[:system_time]
37+
config.before :each do |example|
38+
if time_args = example.metadata[:system_time]
5139
case time_args
5240
when Array then allow(Time).to receive(:now).and_return Time.local(*time_args)
5341
when Time then allow(Time).to receive(:now).and_return time_args

0 commit comments

Comments
 (0)