spec/integration/stomp/stomp_adapter_spec.rb in message-driver-0.2.2 vs spec/integration/stomp/stomp_adapter_spec.rb in message-driver-0.3.0
- old
+ new
@@ -7,26 +7,27 @@
let(:valid_connection_attrs) { BrokerConfig.config }
describe "#initialize" do
let(:connection_attrs) { valid_connection_attrs }
+ let(:broker) { double("broker") }
context "differing stomp versions" do
shared_examples "raises a stomp error" do
it "raises an error" do
stub_const("Stomp::Version::STRING", version)
expect {
- described_class.new(connection_attrs)
+ described_class.new(broker, connection_attrs)
}.to raise_error MessageDriver::Error, "stomp 1.3.1 or a later version of the 1.3.x series is required for the stomp adapter"
end
end
shared_examples "doesn't raise a stomp error" do
it "doesn't raise an an error" do
stub_const("Stomp::Version::STRING", version)
adapter = nil
expect {
- adapter = described_class.new(connection_attrs)
+ adapter = described_class.new(broker, connection_attrs)
}.to_not raise_error
end
end
%w(1.1.0 1.2.9 1.3.0 1.4.0).each do |v|
context "stomp version #{v}" do
@@ -42,11 +43,11 @@
end
end
describe "the resulting config" do
let(:connection_attrs) { {hosts: [{host: "my_host"}]} }
- subject(:config) { described_class.new(connection_attrs).config }
+ subject(:config) { described_class.new(broker, connection_attrs).config }
its([:connect_headers]) { should eq(:"accept-version" => "1.1,1.2") }
its([:hosts]) { should eq(connection_attrs[:hosts]) }
context "when vhost is specified" do
@@ -69,14 +70,11 @@
end
end
end
shared_context "a connected stomp adapter" do
- subject(:adapter) { described_class.new(valid_connection_attrs) }
-
- before do
- MessageDriver::Broker.configure(adapter: adapter)
- end
+ let(:broker) { MessageDriver::Broker.configure(valid_connection_attrs) }
+ subject(:adapter) { broker.adapter }
after do
adapter.stop
end
end