Sha256: a1b61324cc41b1d7d48bf6b814022ffda54b6dd27e65723fd5966921a3514985

Contents?: true

Size: 1.27 KB

Versions: 11

Compression:

Stored size: 1.27 KB

Contents

# -*- coding: utf-8 -*-
require 'spec_helper'

describe "uc08_if_both_a_and_b_occurs" do
  before do
    Tengine::Core::Driver.delete_all
    Tengine::Core::Session.delete_all
    config = Tengine::Core::Config::Core.new({
        :tengined => {
          :load_path => File.expand_path('../../../../examples/uc08_if_both_a_and_b_occurs.rb', File.dirname(__FILE__)),
        },
      })
    @bootstrap = Tengine::Core::Bootstrap.new(config)
    @bootstrap.load_dsl
    @kernel = Tengine::Core::Kernel.new(config)
    @kernel.bind
  end

  it "aとbが両方起きたらハンドラが実行されます" do
    driver = Tengine::Core::Driver.first
    klass = driver.target_class_name.constantize
    obj = klass.new
    klass.should_receive(:new).and_return(obj)

    mock_headers = mock(:headers)
    mock_headers.should_receive(:ack).exactly(3).times
    raw_event = Tengine::Event.new(:event_type_name => "event08_a")
    @kernel.process_message(mock_headers, raw_event.to_json)
    raw_event = Tengine::Event.new(:event_type_name => "event08_a")
    @kernel.process_message(mock_headers, raw_event.to_json)
    obj.should_receive(:puts).with("handler08")
    raw_event = Tengine::Event.new(:event_type_name => "event_08_b")
    @kernel.process_message(mock_headers, raw_event.to_json)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tengine_core-0.5.39 spec/tengine/core/dsls/uc08_if_both_a_and_b_occurs_spec.rb
tengine_core-0.5.38 spec/tengine/core/dsls/uc08_if_both_a_and_b_occurs_spec.rb
tengine_core-0.5.37 spec/tengine/core/dsls/uc08_if_both_a_and_b_occurs_spec.rb
tengine_core-0.5.36 spec/tengine/core/dsls/uc08_if_both_a_and_b_occurs_spec.rb
tengine_core-0.5.35 spec/tengine/core/dsls/uc08_if_both_a_and_b_occurs_spec.rb
tengine_core-0.5.34 spec/tengine/core/dsls/uc08_if_both_a_and_b_occurs_spec.rb
tengine_core-0.5.33 spec/tengine/core/dsls/uc08_if_both_a_and_b_occurs_spec.rb
tengine_core-0.5.32 spec/tengine/core/dsls/uc08_if_both_a_and_b_occurs_spec.rb
tengine_core-0.5.31 spec/tengine/core/dsls/uc08_if_both_a_and_b_occurs_spec.rb
tengine_core-0.5.30 spec/tengine/core/dsls/uc08_if_both_a_and_b_occurs_spec.rb
tengine_core-0.5.28 spec/tengine/core/dsls/uc08_if_both_a_and_b_occurs_spec.rb