From 3a008fd3fff00852533d0df1f597595505373c6b Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Thu, 3 May 2012 19:37:43 +0100 Subject: Updated notification tests to test bank_holiday changes etc. --- test/tc_mauve_notification.rb | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/tc_mauve_notification.rb b/test/tc_mauve_notification.rb index df8fa9b..00005e1 100644 --- a/test/tc_mauve_notification.rb +++ b/test/tc_mauve_notification.rb @@ -1,12 +1,13 @@ $:.unshift "../lib" require 'th_mauve' +require 'mauve/mauve_time' require 'mauve/alert' require 'mauve/notification' +require 'mauve/server' require 'mauve/configuration' require 'mauve/configuration_builder' require 'mauve/configuration_builders' -require 'mauve/mauve_time' require 'webmock' class TcMauveDuringRunner < Mauve::UnitTest @@ -129,6 +130,7 @@ class TcMauveDuringRunner < Mauve::UnitTest [[0..1,3..6], true], [[0..2, 4,5], false], [[0,1..3], true], + [3..3.5, true], [[4..12], false] ].each do |hours, result| assert_equal(result, dr.send(:hours_in_day, hours)) @@ -170,6 +172,15 @@ class TcMauveDuringRunner < Mauve::UnitTest assert(dr.send(:unacknowledged, 1.hour)) end + def test_working_hours + config=< 200, :body => YAML.dump([])) + + dr = DuringRunner.new(Time.now) assert(!dr.send(:bank_holiday?)) - time.bank_holidays << Date.new(Time.now.year, Time.now.month, Time.now.day) + # + # Add today as a bank hol. + # + # time.bank_holidays << Date.new(Time.now.year, Time.now.month, Time.now.day) + + Timecop.freeze(Time.now + 24.hours) + stub_request(:get, "http://localhost/api/bank_holidays/2011-08-02"). + to_return(:status => 200, :body => YAML.dump([Date.new(2011,8,2)])) + + dr = DuringRunner.new(Time.now) assert(dr.send(:bank_holiday?)) end -- cgit v1.2.1