2014-05-03 06:22:05 +08:00
|
|
|
package pebble
|
|
|
|
|
|
|
|
import (
|
2014-05-24 06:09:18 +08:00
|
|
|
. "github.com/onsi/ginkgo"
|
|
|
|
. "github.com/onsi/gomega"
|
2014-05-03 06:22:05 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Describe("PebbleDriver", func() {
|
2014-05-24 06:09:18 +08:00
|
|
|
var (
|
|
|
|
driver *PebbleDriver
|
|
|
|
adaptor *PebbleAdaptor
|
|
|
|
)
|
|
|
|
|
|
|
|
BeforeEach(func() {
|
|
|
|
adaptor = NewPebbleAdaptor("pebble")
|
|
|
|
driver = NewPebbleDriver(adaptor, "pebble")
|
|
|
|
})
|
|
|
|
|
|
|
|
It("Must be able to Start", func() {
|
|
|
|
Expect(driver.Start()).To(Equal(true))
|
|
|
|
})
|
|
|
|
|
|
|
|
It("Must be able to Halt", func() {
|
|
|
|
Expect(driver.Halt()).To(Equal(true))
|
|
|
|
})
|
|
|
|
|
|
|
|
It("Adds message when sending notification", func() {
|
|
|
|
driver.SendNotification("Hello")
|
|
|
|
Expect(driver.Messages[0]).To(Equal("Hello"))
|
|
|
|
})
|
|
|
|
|
|
|
|
It("Retrieves pending messages", func() {
|
|
|
|
driver.SendNotification("Hello")
|
|
|
|
driver.SendNotification("World")
|
|
|
|
|
|
|
|
Expect(driver.PendingMessage()).To(Equal("Hello"))
|
|
|
|
Expect(driver.PendingMessage()).To(Equal("World"))
|
|
|
|
Expect(driver.PendingMessage()).To(Equal(""))
|
|
|
|
})
|
2014-05-03 06:22:05 +08:00
|
|
|
})
|