From 9c6c7847b9aec7ea0b80f97dd81db50b9b8cbb8a Mon Sep 17 00:00:00 2001 From: Michael Kokorin Date: Fri, 19 Feb 2016 12:46:42 +0600 Subject: [PATCH] Fix passing wrong reference in GetArchive method of RepositoryContentsClient --- .../Clients/RepositoryContentsClientTests.cs | 17 +++++++++++++++++ Octokit/Clients/RepositoryContentsClient.cs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Octokit.Tests/Clients/RepositoryContentsClientTests.cs b/Octokit.Tests/Clients/RepositoryContentsClientTests.cs index 85707ee9f7..0e59b5334d 100644 --- a/Octokit.Tests/Clients/RepositoryContentsClientTests.cs +++ b/Octokit.Tests/Clients/RepositoryContentsClientTests.cs @@ -219,5 +219,22 @@ public async Task EnsuresNonNullArguments() await Assert.ThrowsAsync(() => client.UpdateFile("org", "repo", "path/to/file", null)); } } + + public class TheGetArchiveMethod + { + [Fact] + public void EnsurePassingCorrectParameters() + { + var connection = Substitute.For(); + var client = new RepositoryContentsClient(connection); + + client.GetArchive("org", "repo", ArchiveFormat.Tarball, "dev"); + + const string expectedUri = "repos/org/repo/tarball/dev"; + var expectedTimeSpan = TimeSpan.FromMinutes(60); + + connection.Connection.Received().Get(Arg.Is(uri => uri.ToString() == expectedUri), Arg.Is(span => span == expectedTimeSpan)); + } + } } } \ No newline at end of file diff --git a/Octokit/Clients/RepositoryContentsClient.cs b/Octokit/Clients/RepositoryContentsClient.cs index d7770db42b..7f3081c2ea 100644 --- a/Octokit/Clients/RepositoryContentsClient.cs +++ b/Octokit/Clients/RepositoryContentsClient.cs @@ -238,7 +238,7 @@ public Task GetArchiveLink(string owner, string name, ArchiveFormat arch /// The binary contents of the archive public Task GetArchive(string owner, string name, ArchiveFormat archiveFormat, string reference) { - return GetArchive(owner, name, archiveFormat, string.Empty, TimeSpan.FromMinutes(60)); + return GetArchive(owner, name, archiveFormat, reference, TimeSpan.FromMinutes(60)); } ///