defmodule Aprsme.DeploymentNotifierTest do
  use ExUnit.Case, async: false

  alias Aprsme.DeploymentNotifier

  describe "notify_deployment/1" do
    test "broadcasts :new_deployment over Aprsme.PubSub" do
      :ok = Phoenix.PubSub.subscribe(Aprsme.PubSub, "deployment_events")
      now = DateTime.utc_now()

      assert :ok == DeploymentNotifier.notify_deployment(now)

      assert_receive {:new_deployment, %{deployed_at: ^now}}, 1000
    end
  end
end
