// NewStream : constructor of Stream // @Param twInfo ツイッター情報 // return Stream func NewStream(twInfo TwInfo) *Stream { anaconda.SetConsumerKey(twInfo.ConsumerKey) anaconda.SetConsumerSecret(twInfo.ConsumerSecret) return &Stream{ client: anaconda.NewTwitterApi(twInfo.AccessToken, twInfo.AccessTokenSecret), tweetQueue: gq.New(QueueLimit), } }
package goqueue_test import ( "runtime" queue "github.com/DamnWidget/goqueue" ) var _ = Describe("Queue", func() { runtime.GOMAXPROCS(runtime.NumCPU()) Describe("Call the New function", func() { Context("With a fixed size", func() { q := queue.New(10) It("Should return a pointer to a new Queue of that size", func() { Expect(q).ToNot(BeNil()) Expect(q.Cap()).To(Equal(int64(10))) }) }) Context("With non size", func() { q := queue.New() It("Should return a pointer to a new Queue of unlimited size", func() { Expect(q).ToNot(BeNil()) Expect(q.Cap()).To(Equal(int64(-1))) }) }) })