Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
Pattern match on publish result in publihser tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorszun committed Sep 23, 2019
1 parent c322674 commit 4f58f97
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/gen_rmq_publisher_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ defmodule GenRMQ.PublisherTest do
test "should publish message", %{publisher: publisher_pid} = context do
message = %{"msg" => "msg"}

GenRMQ.Publisher.publish(publisher_pid, Jason.encode!(%{"msg" => "msg"}))
:ok = GenRMQ.Publisher.publish(publisher_pid, Jason.encode!(%{"msg" => "msg"}))

Assert.repeatedly(fn -> assert out_queue_count(context) >= 1 end)
{:ok, received_message, meta} = get_message_from_queue(context)
Expand All @@ -68,7 +68,7 @@ defmodule GenRMQ.PublisherTest do
test "should publish message with headers", %{publisher: publisher_pid} = context do
message = %{"msg" => "msg"}

GenRMQ.Publisher.publish(publisher_pid, Jason.encode!(message), "some.routing.key", header1: "value")
:ok = GenRMQ.Publisher.publish(publisher_pid, Jason.encode!(message), "some.routing.key", header1: "value")

Assert.repeatedly(fn -> assert out_queue_count(context) >= 1 end)
{:ok, received_message, meta} = get_message_from_queue(context)
Expand All @@ -80,7 +80,7 @@ defmodule GenRMQ.PublisherTest do
test "should override standard metadata fields from headers", %{publisher: publisher_pid} = context do
message = %{"msg" => "msg"}

GenRMQ.Publisher.publish(
:ok = GenRMQ.Publisher.publish(
publisher_pid,
Jason.encode!(message),
"some.routing.key",
Expand All @@ -103,7 +103,7 @@ defmodule GenRMQ.PublisherTest do
test "should publish a message with priority", %{publisher: publisher_pid} = context do
message = %{"msg" => "with prio"}

GenRMQ.Publisher.publish(
:ok = GenRMQ.Publisher.publish(
publisher_pid,
Jason.encode!(message),
"some.routing.key",
Expand All @@ -127,7 +127,7 @@ defmodule GenRMQ.PublisherTest do
assert new_state.channel.conn.pid != state.channel.conn.pid
end)

GenRMQ.Publisher.publish(publisher_pid, Jason.encode!(message))
:ok = GenRMQ.Publisher.publish(publisher_pid, Jason.encode!(message))

Assert.repeatedly(fn -> assert out_queue_count(context) >= 1 end)
{:ok, received_message, meta} = get_message_from_queue(context)
Expand Down

0 comments on commit 4f58f97

Please sign in to comment.