-
Notifications
You must be signed in to change notification settings - Fork 2
/
testributor_yml_test.go
35 lines (31 loc) · 890 Bytes
/
testributor_yml_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"testing"
)
var testributor_yml_contents = `
worker_init: /bin/bash -c "apt-get install phantomjs"
before: "./scripts/before_build.sh"
each:
pattern: "test/.*_test.rb$"
command: 'bin/rake test %{file}'
`
func TestWorkerInit(t *testing.T) {
testributorYml, err := NewTestributorYml(testributor_yml_contents)
if err != nil {
t.Error(err.Error())
}
expected := "/bin/bash -c \"apt-get install phantomjs\""
if init := testributorYml["worker_init"].(string); init != expected {
t.Error("Expected: \n" + expected + "\nGot: \n" + init)
}
}
func TestBeforeAll(t *testing.T) {
testributorYml, err := NewTestributorYml(testributor_yml_contents)
if err != nil {
t.Error(err.Error())
}
expected := "./scripts/before_build.sh"
if init := testributorYml["before"].(string); init != expected {
t.Error("Expected: \n" + expected + "\nGot: \n" + init)
}
}