Skip to content

Commit

Permalink
Fix passing wrong reference in GetArchive method of RepositoryContent…
Browse files Browse the repository at this point in the history
…sClient
  • Loading branch information
michael-kokorin committed Feb 19, 2016
1 parent e41c32d commit 9c6c784
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions Octokit.Tests/Clients/RepositoryContentsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,22 @@ public async Task EnsuresNonNullArguments()
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));
}
}
}
}
2 changes: 1 addition & 1 deletion Octokit/Clients/RepositoryContentsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public Task<string> GetArchiveLink(string owner, string name, ArchiveFormat arch
/// <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>
Expand Down

0 comments on commit 9c6c784

Please sign in to comment.