Sha256: 38294dff6780ff1234aca315a9516e1a67e082fb243f99da9c73ddbca67d10e3

Contents?: true

Size: 1.33 KB

Versions: 10

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

require 'adhearsion/voip/dsl/dialplan/dispatcher'

module StandardDispatcherBehavior
  def xtest_standard_dispatcher_behavior
    #"This it looks bogus.  Not finished?  Let's not check in failing specs ever if we can help it."
    returned_event_command = Adhearsion::VoIP::DSL::Dialplan::EventCommand.new "ilikesexypants"
    linking_event_command = Adhearsion::VoIP::DSL::Dialplan::EventCommand.new "ihavesexypants" do
      returned_event_command
    end

    dispatcher = @dispatcher_class.new MyFactory
    dispatcher.should_receive(:dispatch!).with(linking_event_command, returned_event_command).and_return(linking_event_command, returned_event_command)
    # returned_event_command.should_receive(:command_block).and_return nil
    dispatcher.dispatch! linking_event_command
  end
end

class NilDispatcher < Adhearsion::VoIP::DSL::Dialplan::CommandDispatcher
  def dispatch!(string)
    # Would send it off to the PBX here (or prepend something to the String)
  end
end

class EvalDispatcher < Adhearsion::VoIP::DSL::Dialplan::CommandDispatcher
  def dispatch!(event)
    eval event.app.to_s
  end
end

class MyFactory

  def initialize(context)
    @context = context
  end

  def sequence
    all = []
    EventCommand.new("2", :response => Numeric) do |response|
      all << response
      all.size > 3 ? all : nil
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
adhearsion-1.2.6 spec/adhearsion/voip/dsl/dispatcher_spec_helper.rb
adhearsion-1.2.5 spec/adhearsion/voip/dsl/dispatcher_spec_helper.rb
adhearsion-1.2.4 spec/adhearsion/voip/dsl/dispatcher_spec_helper.rb
adhearsion-1.2.3 spec/adhearsion/voip/dsl/dispatcher_spec_helper.rb
adhearsion-1.2.1 spec/adhearsion/voip/dsl/dispatcher_spec_helper.rb
adhearsion-1.2.0 spec/adhearsion/voip/dsl/dispatcher_spec_helper.rb
adhearsion-1.1.1 spec/voip/dsl/dispatcher_spec_helper.rb
adhearsion-1.1.0 spec/voip/dsl/dispatcher_spec_helper.rb
adhearsion-1.0.3 spec/voip/dsl/dispatcher_spec_helper.rb
adhearsion-1.0.2 spec/voip/dsl/dispatcher_spec_helper.rb