assert exactly x times

This commit is contained in:
Andrew Waage 2016-10-19 14:33:05 -07:00
parent 77ecafa978
commit 15d0b63b45

View File

@ -29,7 +29,7 @@ describe GitHubChangelogGenerator::OctoFetcher do
context "when raises Octokit::Forbidden" do context "when raises Octokit::Forbidden" do
it "sleeps and retries and then aborts" do it "sleeps and retries and then aborts" do
retry_limit = GitHubChangelogGenerator::OctoFetcher::MAX_FORBIDDEN_RETRIES - 1 retry_limit = GitHubChangelogGenerator::OctoFetcher::MAX_FORBIDDEN_RETRIES - 1
allow(fetcher).to receive(:sleep_base_interval).and_return(0) allow(fetcher).to receive(:sleep_base_interval).exactly(retry_limit).times.and_return(0)
expect(fetcher).to receive(:sys_abort).with("Exceeded retry limit") expect(fetcher).to receive(:sys_abort).with("Exceeded retry limit")
fetcher.send(:check_github_response) { raise(Octokit::Forbidden) } fetcher.send(:check_github_response) { raise(Octokit::Forbidden) }