Skip to content
This repository has been archived by the owner on Sep 11, 2022. It is now read-only.

Commit

Permalink
Optional amqp.yml config - used for testing from under VM
Browse files Browse the repository at this point in the history
  • Loading branch information
arvicco committed Jan 7, 2011
1 parent 0cb4dfd commit 1ec13ec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -5,3 +5,5 @@
.rvmrc
.bundle
Gemfile.lock

spec/amqp.yml
27 changes: 16 additions & 11 deletions spec/spec_helper.rb
Expand Up @@ -8,17 +8,22 @@

require "mq"

# EM.spec_backend = EventMachine::Spec::Rspec

# Usage with tracer:
# 1) Start tracer on a PORT_NUMBER
# 2) ruby spec/sync_async_spec.rb amqp://localhost:PORT_NUMBER
# if ARGV.first && ARGV.first.match(/^amqps?:/)
# amqp_url = ARGV.first
# puts "Using AMQP URL #{amqp_url}"
# else
# amqp_url = "amqp://localhost"
# end
amqp_config = File.dirname(__FILE__) + '/amqp.yml'

if File.exists? amqp_config
class Hash
def symbolize_keys
self.inject({}) do |result, (key, value)|
new_key = key.is_a?(String) ? key.to_sym : key
new_value = value.is_a?(Hash) ? value.symbolize_keys : value
result[new_key] = new_value
result
end
end
end

AMQP_OPTS = YAML::load_file(amqp_config).symbolize_keys[:test]
end

# Shorthand for mocking subject's instance variable
def subject_mock(name, as_null = false)
Expand Down

0 comments on commit 1ec13ec

Please sign in to comment.