-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 fixed a bug that resulted in broadcasting to every brainstorming + …
…added tests (#50)
- Loading branch information
1 parent
fe57109
commit ae1fcf7
Showing
5 changed files
with
51 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
test/mindwendel_web/channels/brainstorming_channel_test.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
defmodule MindwendelWeb.BrainstormingChannelTest do | ||
use MindwendelWeb.ChannelCase | ||
|
||
alias Mindwendel.Factory | ||
alias Mindwendel.Brainstormings | ||
alias Mindwendel.Brainstormings.Idea | ||
|
||
setup do | ||
%{ | ||
brainstorming: Factory.insert!(:brainstorming) | ||
} | ||
end | ||
|
||
describe "subscribe" do | ||
test "listening for the brainstorming gets updates for ideas", %{brainstorming: brainstorming} do | ||
idea = Factory.insert!(:idea, brainstorming: brainstorming) | ||
|
||
Brainstormings.subscribe(brainstorming.id) | ||
Brainstormings.update_idea(idea, %{body: "lalala"}) | ||
assert_received {:idea_updated, idea} | ||
end | ||
|
||
test "does not receive messages from other brainstormings", %{brainstorming: brainstorming} do | ||
idea = Factory.insert!(:idea, brainstorming: brainstorming) | ||
other_brainstorming = Factory.insert!(:brainstorming) | ||
|
||
Brainstormings.subscribe(other_brainstorming.id) | ||
Brainstormings.update_idea(idea, %{body: "lalala"}) | ||
refute_received {:idea_updated, idea} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters