-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #582 from podlove/feature/edit-show
feature: editing existing shows
- Loading branch information
Showing
5 changed files
with
177 additions
and
21 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
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 |
---|---|---|
|
@@ -141,6 +141,43 @@ defmodule Radiator.PodcastTest do | |
assert show == Podcast.get_show!(show.id) | ||
end | ||
|
||
test "update_show/2 with valid data updates the show by removing hosts" do | ||
init_hosts = [ | ||
user_fixture(%{email: "[email protected]"}), | ||
user_fixture(%{email: "[email protected]"}) | ||
] | ||
|
||
show = show_fixture(%{}, init_hosts) | ||
|
||
assert {:ok, %Show{} = show} = Podcast.update_show(show, %{}, []) | ||
show = Podcast.reload_assoc(show, [:hosts]) | ||
assert show.hosts == [] | ||
end | ||
|
||
test "update_show/2 with valid data updates the show by adding hosts" do | ||
updated_hosts = [ | ||
user_fixture(%{email: "[email protected]"}), | ||
user_fixture(%{email: "[email protected]"}) | ||
] | ||
|
||
show = show_fixture(%{}, []) | ||
|
||
assert {:ok, %Show{} = show} = Podcast.update_show(show, %{}, updated_hosts) | ||
show = Podcast.reload_assoc(show, [:hosts]) | ||
assert show.hosts == updated_hosts | ||
end | ||
|
||
test "update_show/2 with valid data updates the show by adding and removing hosts" do | ||
init_hosts = [user_fixture(%{email: "[email protected]"})] | ||
updated_hosts = [user_fixture(%{email: "[email protected]"})] | ||
|
||
show = show_fixture(%{}, init_hosts) | ||
|
||
assert {:ok, %Show{} = show} = Podcast.update_show(show, %{}, updated_hosts) | ||
show = Podcast.reload_assoc(show, [:hosts]) | ||
assert show.hosts == updated_hosts | ||
end | ||
|
||
test "delete_show/1 deletes the show" do | ||
show = show_fixture() | ||
assert {:ok, %Show{}} = Podcast.delete_show(show) | ||
|
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