Sha256: 0531dbc209d10f04ee163e3859253c96559f95e4e67031e2eef2c2288f4119fa

Contents?: true

Size: 1.32 KB

Versions: 6

Compression:

Stored size: 1.32 KB

Contents

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
$LOAD_PATH.unshift File.dirname(__FILE__)
require 'punchblock'
require 'mocha'
require 'countdownlatch'

Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}

RSpec.configure do |config|
  config.mock_with :mocha
  config.filter_run :focus => true
  config.run_all_when_everything_filtered = true
end

def parse_stanza(xml)
  Nokogiri::XML.parse xml, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS
end

def import_stanza(xml)
  Blather::Stanza.import parse_stanza(xml).root
end

shared_examples_for 'event' do
  its(:call_id) { should == '9f00061' }
  its(:component_id) { should == '1' }
end

shared_examples_for 'command_headers' do
  it 'takes a hash of keys and values for headers' do
    headers = { :x_skill => 'agent', :x_customer_id => '8877' }

    control = [ Punchblock::Header.new(:x_skill, 'agent'), Punchblock::Header.new(:x_customer_id, '8877')]

    di = subject.class.new :headers => headers
    di.headers.should have(2).items
    di.headers.each { |i| control.include?(i).should be_true }
  end
end

shared_examples_for 'event_headers' do
  its(:headers) { should == [Punchblock::Header.new(:x_skill, 'agent'), Punchblock::Header.new(:x_customer_id, '8877')]}
  its(:headers_hash) { should == {:x_skill => 'agent', :x_customer_id => '8877'} }
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
punchblock-0.5.1 spec/spec_helper.rb
punchblock-0.5.0 spec/spec_helper.rb
punchblock-0.4.3 spec/spec_helper.rb
punchblock-0.4.2 spec/spec_helper.rb
punchblock-0.4.1 spec/spec_helper.rb
punchblock-0.4.0 spec/spec_helper.rb