Green tests

This commit is contained in:
Adrian Zankich 2014-04-18 14:45:50 -07:00
parent 189dddc3c0
commit d1fc843838
3 changed files with 8 additions and 4 deletions

6
api.go
View File

@ -33,10 +33,14 @@ type jsonConnection struct {
Adaptor string `json:"adaptor"` Adaptor string `json:"adaptor"`
} }
func (me *api) StartApi() { var startApi = func(me *api) {
go me.server.Run() go me.server.Run()
} }
func (me *api) StartApi() {
startApi(me)
}
func Api(bot *Master) *api { func Api(bot *Master) *api {
a := new(api) a := new(api)
a.master = bot a.master = bot

View File

@ -3,7 +3,6 @@ package gobot
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
//"github.com/go-martini/martini"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"io/ioutil" "io/ioutil"
@ -20,7 +19,7 @@ var _ = Describe("Master", func() {
BeforeEach(func() { BeforeEach(func() {
myMaster = GobotMaster() myMaster = GobotMaster()
//startApi = func(m *martini.ClassicMartini) {} startApi = func(m *api) {}
a = Api(myMaster) a = Api(myMaster)
myMaster.Robots = []*Robot{ myMaster.Robots = []*Robot{
newTestRobot("Robot 1"), newTestRobot("Robot 1"),

View File

@ -18,6 +18,7 @@ var _ = Describe("Master", func() {
newTestRobot("Robot 2"), newTestRobot("Robot 2"),
newTestRobot("Robot 3"), newTestRobot("Robot 3"),
} }
startApi = func(m *api) {}
trap = func(c chan os.Signal) { trap = func(c chan os.Signal) {
c <- os.Interrupt c <- os.Interrupt
} }