Ejemplo n.º 1
0
        public void GetCurrentBranchShouldHandleBranches()
        {
            // Arrange
            environment.SetEnvironmentVariable("GITHUB_REF", "refs/heads/master");

            // Act
            var result = buildServer.GetCurrentBranch(false);

            // Assert
            result.ShouldBe("refs/heads/master");
        }
Ejemplo n.º 2
0
        public void GetCurrentBranchShouldGetBranchIfSet()
        {
            // Arrange
            const string expected = "actionsBranch";

            environment.SetEnvironmentVariable("GITHUB_REF", $"refs/heads/{expected}");

            // Act
            var result = buildServer.GetCurrentBranch(false);

            // Assert
            result.ShouldBe(expected);
        }
Ejemplo n.º 3
0
        public void GetCurrentBranchShouldNotMatchTag()
        {
            // Arrange
            environment.SetEnvironmentVariable("GITHUB_REF", $"refs/tags/v1.0.0");

            var buildServer = new GitHubActions(environment, log);

            // Act
            var result = buildServer.GetCurrentBranch(false);

            // Assert
            result.ShouldBeNull();
        }