diff --git a/.travis.yml b/.travis.yml index e7cb746..1880353 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ rvm: # - 1.9.3 - 2.0 - 2.1 + - 2.2.4 # - jruby-18mode # JRuby in 1.8 mode # - jruby-19mode # JRuby in 1.9 mode # - rbx-18mode diff --git a/Gemfile.lock b/Gemfile.lock index 5e6dcab..24f185f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,7 +39,7 @@ GEM test-unit (3.1.5) power_assert tilt (1.4.1) - time-warp (1.0.8) + time-warp (1.0.15) twss (0.0.5) classifier (= 1.3.1) webmock (1.6.4) @@ -66,4 +66,4 @@ DEPENDENCIES webmock BUNDLED WITH - 1.11.2 + 1.13.1 diff --git a/README.rdoc b/README.rdoc index 4380c81..93798a6 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,3 +1,5 @@ +{Build Status}[https://travis-ci.org/justinweiss/robut] + = Robut The friendly plugin-enabled HipChat bot. diff --git a/Rakefile b/Rakefile index 0dccb9b..c3514ce 100644 --- a/Rakefile +++ b/Rakefile @@ -25,3 +25,6 @@ Rake::RDocTask.new do |rd| rd.rdoc_dir = 'doc' end +task :console do + exec "irb -r robut -I ./lib" +end \ No newline at end of file diff --git a/lib/robut/plugin/weather.rb b/lib/robut/plugin/weather.rb index 1708738..9b3cde3 100644 --- a/lib/robut/plugin/weather.rb +++ b/lib/robut/plugin/weather.rb @@ -18,7 +18,7 @@ def usage "#{at_nick} weather Tuesday - returns the weather for Tuesday" ] end - + def handle(time, sender_nick, message) # ignore messages that don't end in ? return unless message[message.length - 1, 1] == "?" diff --git a/test/fixtures/seattle.xml b/test/fixtures/seattle.xml index 83158c2..a503b54 100644 --- a/test/fixtures/seattle.xml +++ b/test/fixtures/seattle.xml @@ -1 +1,50 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/unit/plugin/weather_test.rb b/test/unit/plugin/weather_test.rb index dbd471b..1c4c088 100644 --- a/test/unit/plugin/weather_test.rb +++ b/test/unit/plugin/weather_test.rb @@ -51,7 +51,7 @@ def test_no_question_mark def test_handle_day stub_request(:any, "http://www.google.com/ig/api?weather=Seattle").to_return(:body => File.open(File.expand_path("../../../fixtures/seattle.xml", __FILE__), "r").read) - pretend_now_is(2011,"may",23,17) do + pretend_now_is(Time.parse("2011/05/23 17:00")) do @plugin.handle(Time.now, "John", "Seattle weather tuesday?") assert_equal( ["Forecast for Seattle, WA on Tue: Partly Cloudy, High: 67F, Low: 51F"], @plugin.reply_to.replies ) end @@ -60,7 +60,7 @@ def test_handle_day def test_handle_tomorrow stub_request(:any, "http://www.google.com/ig/api?weather=Seattle").to_return(:body => File.open(File.expand_path("../../../fixtures/seattle.xml", __FILE__), "r").read) - pretend_now_is(2011,"may",23,17) do + pretend_now_is(Time.parse("2011/05/23 17:00")) do @plugin.handle(Time.now, "John", "Seattle weather tomorrow?") assert_equal( ["Forecast for Seattle, WA on Tue: Partly Cloudy, High: 67F, Low: 51F"], @plugin.reply_to.replies ) end @@ -69,7 +69,7 @@ def test_handle_tomorrow def test_handle_today stub_request(:any, "http://www.google.com/ig/api?weather=Seattle").to_return(:body => File.open(File.expand_path("../../../fixtures/seattle.xml", __FILE__), "r").read) - pretend_now_is(2011,"may",23,17) do + pretend_now_is(Time.parse("2011/05/23 17:00")) do @plugin.handle(Time.now, "John", "Seattle weather today?") assert_equal( ["Forecast for Seattle, WA on Mon: Partly Cloudy, High: 59F, Low: 48F"], @plugin.reply_to.replies ) end