Sha256: 575e540afb8ea1c416a1f85ac1dd7caa0e432460d01459cabfca1f3ee30255c0

Contents?: true

Size: 1.16 KB

Versions: 11

Compression:

Stored size: 1.16 KB

Contents

require 'test_helper'
require 'robut/plugin/lunch'

class Robut::Plugin::LunchTest < Test::Unit::TestCase

  def setup
    @connection = Robut::ConnectionMock.new
    @presence = Robut::PresenceMock.new(@connection)
    @plugin = Robut::Plugin::Lunch.new(@presence)
    @plugin.places = ["Pho"]
  end

  def test_handle_returns_pho_for_lunch
    @plugin.handle(Time.now, "John", "lunch?")
    assert_equal ["Pho!"], @plugin.reply_to.replies
  end
  
  def test_handle_returns_all_places_for_lunch_places
    @plugin.new_place("Teriyaki")
    @plugin.handle(Time.now, "John", "@robut lunch places")
    assert_equal ["Pho, Teriyaki"], @plugin.reply_to.replies
  end
  
  def test_handle_new_lunch_place
    @plugin.handle(Time.now, "John", "@robut new lunch place Green Leaf")
    assert_equal ["Ok, I'll add \"Green Leaf\" to the the list of lunch places"], @plugin.reply_to.replies
    assert @plugin.places.include?("Green Leaf")
  end
  
  def test_handle_remove_lunch_place
    @plugin.handle(Time.now, "John", "@robut remove lunch place Pho")
    assert_equal ["I removed \"Pho\" from the list of lunch places"], @plugin.reply_to.replies
    assert @plugin.places.empty?
  end

end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
sclemmer-robut-0.6.3 test/unit/plugin/lunch_test.rb
sclemmer-robut-0.6.2 test/unit/plugin/lunch_test.rb
sclemmer-robut-0.6.1 test/unit/plugin/lunch_test.rb
sclemmer-robut-0.6.0 test/unit/plugin/lunch_test.rb
sclemmer-robut-0.5.4 test/unit/plugin/lunch_test.rb
sclemmer-robut-0.5.3 test/unit/plugin/lunch_test.rb
sclemmer-robut-0.5.2 test/unit/plugin/lunch_test.rb
robut-0.5.2 test/unit/plugin/lunch_test.rb
robut-0.5.1 test/unit/plugin/lunch_test.rb
robut-0.5.0 test/unit/plugin/lunch_test.rb
robut-0.4.0 test/unit/plugin/lunch_test.rb