Update sphero tests

This commit is contained in:
Adrian Zankich 2014-06-13 14:26:18 -07:00
parent f5e38ae336
commit 1a63727776
3 changed files with 29 additions and 59 deletions

View File

@ -1,13 +0,0 @@
package sphero
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestGobotSphero(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Sphero Suite")
}

View File

@ -1,31 +1,21 @@
package sphero
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/hybridgroup/gobot"
"testing"
)
var _ = Describe("SpheroAdaptor", func() {
var (
a *SpheroAdaptor
)
var a *SpheroAdaptor
BeforeEach(func() {
a = NewSpheroAdaptor("bot", "/dev/null")
a.sp = sp{}
a.connect = func(a *SpheroAdaptor) {}
})
func init() {
a = NewSpheroAdaptor("bot", "/dev/null")
a.sp = sp{}
a.connect = func(a *SpheroAdaptor) {}
}
It("Must be able to Finalize", func() {
Expect(a.Finalize()).To(Equal(true))
})
It("Must be able to Connect", func() {
Expect(a.Connect()).To(Equal(true))
})
It("Must be able to Disconnect", func() {
Expect(a.Disconnect()).To(Equal(true))
})
It("Must be able to Reconnect", func() {
Expect(a.Reconnect()).To(Equal(true))
})
})
func TestFinalize(t *testing.T) {
gobot.Expect(t, a.Finalize(), true)
}
func TestConnect(t *testing.T) {
gobot.Expect(t, a.Connect(), true)
}

View File

@ -1,29 +1,22 @@
package sphero
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/hybridgroup/gobot"
"testing"
)
var _ = Describe("SpheroDriver", func() {
var (
s *SpheroDriver
a *SpheroAdaptor
)
var s *SpheroDriver
BeforeEach(func() {
a = NewSpheroAdaptor("bot", "/dev/null")
a.sp = sp{}
s = NewSpheroDriver(a, "bot")
})
func init() {
a := NewSpheroAdaptor("bot", "/dev/null")
a.sp = sp{}
s = NewSpheroDriver(a, "bot")
}
It("Must be able to Start", func() {
Expect(s.Start()).To(Equal(true))
})
It("Must be able to Init", func() {
Expect(s.Init()).To(Equal(true))
})
It("Must be able to Halt", func() {
Expect(s.Halt()).To(Equal(true))
})
})
func TestStart(t *testing.T) {
gobot.Expect(t, s.Start(), true)
}
func TestHalt(t *testing.T) {
gobot.Expect(t, s.Halt(), true)
}