Merge pull request #1113 from michael-kokorin/bug-1102-wrong-reference

Fix passing wrong reference in GetArchive method of RepositoryContentsClient
This commit is contained in:
Brendan Forster
2016-02-20 09:02:47 +11:00
2 changed files with 18 additions and 1 deletions
@@ -219,5 +219,22 @@ namespace Octokit.Tests.Clients
await Assert.ThrowsAsync<ArgumentNullException>(() => client.UpdateFile("org", "repo", "path/to/file", null));
}
}
public class TheGetArchiveMethod
{
[Fact]
public void EnsurePassingCorrectParameters()
{
var connection = Substitute.For<IApiConnection>();
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<byte[]>(Arg.Is<Uri>(uri => uri.ToString() == expectedUri), Arg.Is<TimeSpan>(span => span == expectedTimeSpan));
}
}
}
}
+1 -1
View File
@@ -238,7 +238,7 @@ namespace Octokit
/// <returns>The binary contents of the archive</returns>
public Task<byte[]> 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));
}
/// <summary>