Skip to content

Commit 128a211

Browse files
committed
clarify test string
1 parent e187cea commit 128a211

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

modules/actions/workflows_test.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,26 @@ import (
99
"code.gitea.io/gitea/modules/git"
1010
"code.gitea.io/gitea/modules/setting"
1111
api "code.gitea.io/gitea/modules/structs"
12+
"code.gitea.io/gitea/modules/test"
1213
webhook_module "code.gitea.io/gitea/modules/webhook"
1314

1415
"github.com/stretchr/testify/assert"
1516
)
1617

17-
func fullWorkflowContent(yamlOn string) []byte {
18-
return []byte("name: test\n" + yamlOn + "\njobs:\n test:\n runs-on: ubuntu-latest\n steps:\n - run: echo hello\n")
18+
func fullWorkflowContent(part string) []byte {
19+
return []byte(`
20+
name: test
21+
` + part + `
22+
jobs:
23+
test:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- run: echo hello
27+
`)
1928
}
2029

2130
func TestIsWorkflow(t *testing.T) {
22-
oldDirs := setting.Actions.WorkflowDirs
23-
defer func() {
24-
setting.Actions.WorkflowDirs = oldDirs
25-
}()
31+
defer test.MockVariableValue(&setting.Actions.WorkflowDirs)()
2632

2733
tests := []struct {
2834
name string

0 commit comments

Comments
 (0)