Sha256: 1c2c822e0d4cbfc4fa8c426db4213f8b6cbf0e126bee0ad8cbc2c49054aa9bf4

Contents?: true

Size: 530 Bytes

Versions: 18

Compression:

Stored size: 530 Bytes

Contents

require "spec_helper"

describe Ruboty::Handlers::Base do
  after do
    Ruboty.handlers.pop
  end

  let(:robot) do
    Ruboty::Robot.new
  end

  let!(:handler_class) do
    Class.new(described_class) do
      on(/(\d+) \+ (\d+)/, name: "addition", all: true)

      def addition(message)
        robot.say(message[1].to_i + message[2].to_i)
      end
    end
  end

  describe ".on" do
    it "registers an action to the handler" do
      robot.should_receive(:say).with(2)
      robot.receive(body: "1 + 1")
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ruboty-1.2.2 spec/ruboty/handlers/base_spec.rb
ruboty-1.2.1 spec/ruboty/handlers/base_spec.rb
ruboty-1.2.0 spec/ruboty/handlers/base_spec.rb
ruboty-1.1.9 spec/ruboty/handlers/base_spec.rb
ruboty-1.1.8 spec/ruboty/handlers/base_spec.rb
ruboty-1.1.7 spec/ruboty/handlers/base_spec.rb
ruboty-1.1.6 spec/ruboty/handlers/base_spec.rb
ruboty-1.1.5 spec/ruboty/handlers/base_spec.rb
ruboty-1.1.4 spec/ruboty/handlers/base_spec.rb
ruboty-1.1.3 spec/ruboty/handlers/base_spec.rb
ruboty-1.1.2 spec/ruboty/handlers/base_spec.rb
ruboty-1.1.1 spec/ruboty/handlers/base_spec.rb
ruboty-1.1.0 spec/ruboty/handlers/base_spec.rb
ruboty-1.0.4 spec/ruboty/handlers/base_spec.rb
ruboty-1.0.3 spec/ruboty/handlers/base_spec.rb
ruboty-1.0.2 spec/ruboty/handlers/base_spec.rb
ruboty-1.0.1 spec/ruboty/handlers/base_spec.rb
ruboty-1.0.0 spec/ruboty/handlers/base_spec.rb