@@ -63,7 +63,7 @@ defmodule FunWithFlags.Notifications.PhoenixPubSubTest do
6363 assert { :ok , _pid } = PubSub . publish_change ( name )
6464
6565 payload = { :updated , name , u_id }
66-
66+
6767 receive do
6868 { :fwf_changes , ^ payload } -> :ok
6969 after
@@ -104,7 +104,7 @@ defmodule FunWithFlags.Notifications.PhoenixPubSubTest do
104104 client = FunWithFlags.Config . pubsub_client ( )
105105 channel = "fun_with_flags_changes"
106106 message = { :fwf_changes , { :updated , :a_flag_name , u_id } }
107-
107+
108108 with_mock ( Store , [ :passthrough ] , [ ] ) do
109109 Phoenix.PubSub . broadcast! ( client , channel , message )
110110 :timer . sleep ( 30 )
@@ -120,7 +120,7 @@ defmodule FunWithFlags.Notifications.PhoenixPubSubTest do
120120 client = FunWithFlags.Config . pubsub_client ( )
121121 channel = "fun_with_flags_changes"
122122 message = { :fwf_changes , { :updated , :a_flag_name , another_u_id } }
123-
123+
124124 with_mock ( Store , [ :passthrough ] , [ ] ) do
125125 Phoenix.PubSub . broadcast! ( client , channel , message )
126126 :timer . sleep ( 30 )
@@ -149,18 +149,22 @@ defmodule FunWithFlags.Notifications.PhoenixPubSubTest do
149149 assert { :ok , ^ stored_flag } = Config . persistence_adapter . get ( name )
150150 assert { :ok , ^ cached_flag } = Cache . get ( name )
151151
152- refute match? ^ stored_flag , cached_flag
153-
154152 { :ok , name: name , stored_flag: stored_flag , cached_flag: cached_flag }
155153 end
156154
155+ # This should be in `setup` but in there it produces a compiler warning because
156+ # the two variables will never match (duh).
157+ test "verify test setup" , % { cached_flag: cached_flag , stored_flag: stored_flag } do
158+ refute match? ^ stored_flag , cached_flag
159+ end
160+
157161
158162 test "when the message comes from this same process, the Cached value is not changed" , % { name: name , cached_flag: cached_flag } do
159163 u_id = PubSub . unique_id ( )
160164 client = FunWithFlags.Config . pubsub_client ( )
161165 channel = "fun_with_flags_changes"
162166 message = { :fwf_changes , { :updated , name , u_id } }
163-
167+
164168 Phoenix.PubSub . broadcast! ( client , channel , message )
165169 :timer . sleep ( 30 )
166170 assert { :ok , ^ cached_flag } = Cache . get ( name )
@@ -174,7 +178,7 @@ defmodule FunWithFlags.Notifications.PhoenixPubSubTest do
174178 client = FunWithFlags.Config . pubsub_client ( )
175179 channel = "fun_with_flags_changes"
176180 message = { :fwf_changes , { :updated , name , another_u_id } }
177-
181+
178182 assert { :ok , ^ cached_flag } = Cache . get ( name )
179183 Phoenix.PubSub . broadcast! ( client , channel , message )
180184 :timer . sleep ( 30 )
0 commit comments