Created
November 7, 2018 17:00
-
-
Save sescobb27/15530d16b45b9f950665681f57f90b26 to your computer and use it in GitHub Desktop.
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
defmodule Test.Services.ReleasePollerTest do | |
use Test.DataCase, async: true | |
import Mimic | |
import Test.Factory | |
alias Test.Services.RPC | |
setup :verify_on_exit! | |
test "successfully started polling repository - no error" do | |
repo = insert(:repository) | |
pid = self() | |
RPC | |
|> stub(:start_polling_repo, fn payload -> | |
assert %{ | |
adapter: "github", | |
github_token: nil, | |
id: repo.id, | |
polling_interval: repo.polling_interval, | |
repository_url: repo.repository_url | |
} == payload | |
{:ok, pid} | |
end) | |
assert {:ok, ^pid} = ReleasePoller.start_polling_repo(repo) | |
end | |
test "error starting to poll repository - node down" do | |
repo = insert(:repository) | |
RPC | |
|> stub(:start_polling_repo, fn _ -> | |
{:badrpc, :nodedown} | |
end) | |
assert {:error, :nodedown} = ReleasePoller.start_polling_repo(repo) | |
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
Mimic.copy(ReleaseAdmin.Services.RPC) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment