Skip to content

Commit

Permalink
More test refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Sep 24, 2024
1 parent cbec462 commit 6e89470
Showing 1 changed file with 12 additions and 24 deletions.
36 changes: 12 additions & 24 deletions spec/lower_level_api/integration/queue_declare_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,10 @@
end
end

RSpec.shared_examples "verifies optional x-argument equivalence" do |queue_name, arg, val1, val2|
RSpec.shared_examples "verifies optional x-argument equivalence" do |arg, val1, val2|
it "raises an exception when optional argument #{arg} values do not match that of the original declaration" do
queue_name = "bunny.tests.low-level.queues.proprty-equivalence.x-args.#{arg}"

ch = connection.create_channel
cleanup_ch = connection.create_channel
cleanup_ch.queue_delete(queue_name)
Expand All @@ -183,25 +185,16 @@
end
end

include_examples "verifies optional x-argument equivalence",
"bunny.tests.low-level.queues.proprty-equivalence.x-args.x-max-length",
"x-max-length", 50, 100

include_examples "verifies optional x-argument equivalence",
"bunny.tests.low-level.queues.proprty-equivalence.x-args.x-max-length-bytes",
"x-max-length-bytes", 1000000, 99900000

include_examples "verifies optional x-argument equivalence",
"bunny.tests.low-level.queues.proprty-equivalence.x-args.x-expires",
"x-expires", 2200000, 5500000
include_examples "verifies optional x-argument equivalence", "x-max-length", 100, 200
include_examples "verifies optional x-argument equivalence", "x-max-length-bytes", 1000000, 99900000
include_examples "verifies optional x-argument equivalence", "x-expires", 2200000, 5500000
include_examples "verifies optional x-argument equivalence", "x-message-ttl", 3000, 5000

include_examples "verifies optional x-argument equivalence",
"bunny.tests.low-level.queues.proprty-equivalence.x-args.x-message-ttl",
"x-message-ttl", 3000, 5000


RSpec.shared_examples "ignores optional x-argument equivalence" do |queue_name, arg, val1, val2|
RSpec.shared_examples "ignores optional x-argument equivalence" do |arg, val1, val2|
it "DOES NOT raise an exception when optional argument #{arg} values do not match that of the original declaration" do
queue_name = "bunny.tests.low-level.queues.proprty-equivalence.x-args.#{arg}"

ch = connection.create_channel
cleanup_ch = connection.create_channel
cleanup_ch.queue_delete(queue_name)
Expand All @@ -215,12 +208,7 @@
end
end

include_examples "ignores optional x-argument equivalence",
"bunny.tests.low-level.queues.proprty-equivalence.x-args.x-consumer-timeout",
"x-consumer-timeout", 10_000, 20_000

include_examples "ignores optional x-argument equivalence",
"bunny.tests.low-level.queues.proprty-equivalence.x-args.x-alternate-exchange",
"x-alternate-exchange", "amq.fanout", "amq.topic"
include_examples "ignores optional x-argument equivalence", "x-consumer-timeout", 10_000, 20_000
include_examples "ignores optional x-argument equivalence", "x-alternate-exchange", "amq.fanout", "amq.topic"

end

0 comments on commit 6e89470

Please sign in to comment.