upgrade webmock
MODIFY
beetle.gemspec
beetle.gemspec
@@ -35,11 +35,11 @@ Gem::Specification.new do |s|
s.add_development_dependency "daemons", ">= 1.2.0"
s.add_development_dependency "i18n"
s.add_development_dependency "minitest", "~> 5.1"
- s.add_development_dependency "mocha", "~> 1.1.0"
+ s.add_development_dependency "mocha", "~> 1.3.0"
s.add_development_dependency "mysql2", "~> 0.4.4"
s.add_development_dependency "rake", "~> 11.2"
s.add_development_dependency "rdoc", "~> 4.0"
- s.add_development_dependency "simplecov", "~> 0.12.0"
- s.add_development_dependency "webmock", "~> 1.21.0"
+ s.add_development_dependency "simplecov", "~> 0.15"
+ s.add_development_dependency "webmock", "~> 3.0"
s.add_development_dependency "websocket-eventmachine-client"
end

MODIFY
test/beetle/dead_lettering_test.rb
test/beetle/dead_lettering_test.rb
@@ -40,23 +40,25 @@ module Beetle
end
test "creates a policy by posting to the rabbitmq" do
- stub_request(:put, "http://guest:guest@localhost:15672/api/policies/%2F/QUEUE_NAME_policy").
- with(:body => {
+ stub_request(:put, "http://localhost:15672/api/policies/%2F/QUEUE_NAME_policy")
+ .with(basic_auth: ['guest', 'guest'])
+ .with(:body => {
"pattern" => "^QUEUE_NAME$",
"priority" => 1,
"apply-to" => "queues",
"definition" => {
"dead-letter-routing-key" => "QUEUE_NAME_dead_letter",
"dead-letter-exchange" => ""
- }}.to_json).
- to_return(:status => 204)
+ }}.to_json)
+ .to_return(:status => 204)
@dead_lettering.set_dead_letter_policy!(@server, @queue_name)
end
test "raises exception when policy couldn't successfully be created" do
- stub_request(:put, "http://guest:guest@localhost:15672/api/policies/%2F/QUEUE_NAME_policy").
- to_return(:status => [405])
+ stub_request(:put, "http://localhost:15672/api/policies/%2F/QUEUE_NAME_policy")
+ .with(basic_auth: ['guest', 'guest'])
+ .to_return(:status => [405])
assert_raises DeadLettering::FailedRabbitRequest do
@dead_lettering.set_dead_letter_policy!(@server, @queue_name)
@@ -64,8 +66,9 @@ module Beetle
end
test "can optionally specify a message ttl" do
- stub_request(:put, "http://guest:guest@localhost:15672/api/policies/%2F/QUEUE_NAME_policy").
- with(:body => {
+ stub_request(:put, "http://localhost:15672/api/policies/%2F/QUEUE_NAME_policy")
+ .with(basic_auth: ['guest', 'guest'])
+ .with(:body => {
"pattern" => "^QUEUE_NAME$",
"priority" => 1,
"apply-to" => "queues",
@@ -73,23 +76,24 @@ module Beetle
"dead-letter-routing-key" => "QUEUE_NAME_dead_letter",
"dead-letter-exchange" => "",
"message-ttl" => 10000
- }}.to_json).
- to_return(:status => 204)
+ }}.to_json)
+ .to_return(:status => 204)
@dead_lettering.set_dead_letter_policy!(@server, @queue_name, :message_ttl => 10000)
end
test "properly encodes the vhost from the configuration" do
- stub_request(:put, "http://guest:guest@localhost:15672/api/policies/foo%2F/QUEUE_NAME_policy").
- with(:body => {
+ stub_request(:put, "http://localhost:15672/api/policies/foo%2F/QUEUE_NAME_policy")
+ .with(basic_auth: ['guest', 'guest'])
+ .with(:body => {
"pattern" => "^QUEUE_NAME$",
"priority" => 1,
"apply-to" => "queues",
"definition" => {
"dead-letter-routing-key" => "QUEUE_NAME_dead_letter",
"dead-letter-exchange" => ""
- }}.to_json).
- to_return(:status => 204)
+ }}.to_json)
+ .to_return(:status => 204)
@config.vhost = "foo/"

MODIFY
test/test_helper.rb
test/test_helper.rb
@@ -17,6 +17,7 @@ class Minitest::Test
require "active_support/testing/declarative"
extend ActiveSupport::Testing::Declarative
require "webmock"
+ WebMock.enable!
include WebMock::API
def assert_nothing_raised(*)
yield

upgrade webmock