Sha256: 3d6ca52f06dbaa1f73b9f5e36484f428cf4fe0761544368146645a0564304020

Contents?: true

Size: 716 Bytes

Versions: 2

Compression:

Stored size: 716 Bytes

Contents

require 'brown/test'

module Brown::SpecHelpers
	def self.included(mod)
		mod.let(:agent_env) { { "AMQP_URL" => "amqp://spec.example.invalid" } }
		mod.let(:agent) { described_class.new(agent_env) }

		if mod.described_class.respond_to?(:amqp_publishers)
			(mod.described_class.amqp_publishers || []).each do |publisher|
				mod.let(:"#{publisher[:name]}_publisher") { instance_double(Brown::Agent::AMQPPublisher, publisher[:name]) }
			end
		end

		mod.before(:each) do
			if described_class.respond_to?(:amqp_publishers)
				(described_class.amqp_publishers || []).each do |publisher|
					allow(agent).to receive(publisher[:name]).and_return(send(:"#{publisher[:name]}_publisher"))
				end
			end
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
brown-2.2.2.27.gbc378e8 lib/brown/rspec.rb
brown-2.2.2.25.g85ddf08 lib/brown/rspec.rb