2013-12-31 09:22:16 +08:00
|
|
|
package gobot
|
|
|
|
|
|
|
|
import (
|
|
|
|
. "github.com/onsi/ginkgo"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Describe("Device", func() {
|
|
|
|
|
|
|
|
var (
|
|
|
|
someRobot Robot
|
|
|
|
)
|
|
|
|
|
|
|
|
BeforeEach(func() {
|
2014-01-01 05:16:25 +08:00
|
|
|
someRobot = newTestRobot("")
|
2014-01-01 05:29:01 +08:00
|
|
|
someRobot.startRobot()
|
2013-12-31 09:22:16 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
Context("when valid", func() {
|
|
|
|
It("Commands should return device commands", func() {
|
|
|
|
Expect(someRobot.devices[0].Commands()).To(Equal([]string{"DriverCommand1", "DriverCommand2", "DriverCommand3"}))
|
|
|
|
})
|
2014-01-01 05:29:01 +08:00
|
|
|
It("Start should call driver start", func() {
|
|
|
|
Expect(someRobot.Devices[0].Start()).To(Equal(true))
|
|
|
|
})
|
2013-12-31 09:22:16 +08:00
|
|
|
})
|
|
|
|
})
|