Sha256: f8bac349abb6eb1167ee562f06c30957979f768fff36d16c376d5c5a81f300c0

Contents?: true

Size: 465 Bytes

Versions: 7

Compression:

Stored size: 465 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "Chatterbot::Handler" do
  it "accepts a block" do
    @foo = nil
    h = Chatterbot::Handler.new({}) do |_|
      @foo = "bar"
    end

    h.call

    expect(@foo).to eql("bar")
  end

  it "accepts a proc/etc directly" do
    @foo = nil
    @proc = Proc.new do |_|
      @foo = "bar"
    end

    h = Chatterbot::Handler.new(@proc)
    h.call

    expect(@foo).to eql("bar")

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
chatterbot-2.2.0 spec/handler_spec.rb
chatterbot-2.1.0 spec/handler_spec.rb
chatterbot-2.0.5 spec/handler_spec.rb
chatterbot-2.0.4 spec/handler_spec.rb
chatterbot-2.0.3 spec/handler_spec.rb
chatterbot-2.0.2 spec/handler_spec.rb
chatterbot-2.0.0.pre spec/handler_spec.rb