Skip to content

Commit

Permalink
Fixing some code and finally have Travis building
Browse files Browse the repository at this point in the history
Signed-off-by: Cale Hoopes <[email protected]>
  • Loading branch information
caledhwa committed Jul 17, 2016
1 parent dcb6354 commit 7cdd995
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 1 addition & 6 deletions platforms/nats/nats_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,7 @@ func (a *NatsAdaptor) On(event string, f func(s []byte)) bool {
return false
}
a.client.Subscribe(event, func(msg *nats.Msg) {
incoming := msg.Data
if string(incoming) == "PING" {
a.Publish(event, []byte("PONG"))
} else {
f(msg.Data)
}
f(msg.Data)
})
return true
}
5 changes: 5 additions & 0 deletions platforms/nats/nats_adaptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import (

var _ gobot.Adaptor = (*NatsAdaptor)(nil)

func TestNatsAdaptorReturnsName(t *testing.T) {
a := NewNatsAdaptor("Nats", "localhost:4222", 9999)
gobottest.Assert(t, a.Name(), "Nats")
}

func TestNatsAdaptorPublishWhenConnected(t *testing.T) {
a := NewNatsAdaptor("Nats", "localhost:4222", 9999)
a.Connect()
Expand Down

0 comments on commit 7cdd995

Please sign in to comment.