spec/spec_helper.rb in punchblock-1.9.4 vs spec/spec_helper.rb in punchblock-2.0.0.beta1
- old
+ new
@@ -1,19 +1,26 @@
# encoding: utf-8
require 'punchblock'
require 'countdownlatch'
require 'logger'
+require 'celluloid'
+require 'coveralls'
+Coveralls.wear!
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
Thread.abort_on_exception = true
RSpec.configure do |config|
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
+ config.mock_with :rspec do |mocks|
+ mocks.add_stub_and_should_receive_to Celluloid::AbstractProxy
+ end
+
config.before :suite do |variable|
Punchblock.logger = Logger.new(STDOUT)
Punchblock.logger.define_singleton_method :trace, Punchblock.logger.method(:debug)
end
@@ -40,23 +47,12 @@
its(:target_call_id) { should be == '9f00061' }
its(:component_id) { should be == '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 be == [Punchblock::Header.new('X-skill', 'agent'), Punchblock::Header.new('X-customer-id', '8877')]}
- its(:headers_hash) { should be == {:x_skill => 'agent', :x_customer_id => '8877'} }
end
shared_examples_for 'key_value_pairs' do
it 'will auto-inherit nodes' do
n = parse_stanza "<#{element_name} name='boo' value='bah' />"