More test coverage
This commit is contained in:
parent
d6d9e89e96
commit
50db5504b8
|
@ -52,7 +52,3 @@ func (c *connection) Reconnect() bool {
|
|||
log.Println("Reconnecting to " + c.Name + " on port " + c.Port + "...")
|
||||
return c.Adaptor.Reconnect()
|
||||
}
|
||||
|
||||
func (c *connection) AdaptorName() string {
|
||||
return c.Name
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package gobot
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("Connection", func() {
|
||||
|
||||
var (
|
||||
someRobot Robot
|
||||
)
|
||||
|
||||
BeforeEach(func() {
|
||||
someRobot = newTestRobot("")
|
||||
someRobot.startRobot()
|
||||
})
|
||||
|
||||
Context("when valid", func() {
|
||||
It("Connect should call adaptor Connect", func() {
|
||||
Expect(someRobot.Connections[0].Connect()).To(Equal(true))
|
||||
})
|
||||
It("Finalize should call adaptor Finalize", func() {
|
||||
Expect(someRobot.Connections[0].Connect()).To(Equal(true))
|
||||
})
|
||||
It("Disconnect should call adaptor Disconnect", func() {
|
||||
Expect(someRobot.Connections[0].Connect()).To(Equal(true))
|
||||
})
|
||||
It("Reconnect should call adaptor Reconnect", func() {
|
||||
Expect(someRobot.Connections[0].Connect()).To(Equal(true))
|
||||
})
|
||||
})
|
||||
})
|
|
@ -13,12 +13,15 @@ var _ = Describe("Device", func() {
|
|||
|
||||
BeforeEach(func() {
|
||||
someRobot = newTestRobot("")
|
||||
someRobot.startRobot()
|
||||
})
|
||||
|
||||
Context("when valid", func() {
|
||||
It("Commands should return device commands", func() {
|
||||
someRobot.initDevices()
|
||||
Expect(someRobot.devices[0].Commands()).To(Equal([]string{"DriverCommand1", "DriverCommand2", "DriverCommand3"}))
|
||||
})
|
||||
It("Start should call driver start", func() {
|
||||
Expect(someRobot.Devices[0].Start()).To(Equal(true))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue