Exemplo n.º 1
0
					os.Unsetenv("BOTMETRICS_API_KEY")
					os.Unsetenv("BOTMETRICS_BOT_ID")
				})

				It("should return a client and no error", func() {
					c, err := NewBotmetricsClient()
					Expect(c.ApiKey).To(Equal("api_key"))
					Expect(c.BotId).To(Equal("bot_id"))
					Expect(err).To(BeNil())
				})
			})
		})
	})

	Describe("RegisterBot", func() {
		var server *ghttp.Server
		var bc *BotmetricsClient
		var err error

		BeforeEach(func() {
			server = ghttp.NewServer()
			os.Setenv("BOTMETRICS_API_HOST", server.URL())
			bc, err = NewBotmetricsClient("api-key", "bot-id")
			Expect(err).To(BeNil())
		})

		AfterEach(func() {
			server.Close()
			os.Unsetenv("BOTMETRICS_API_HOST")
		})
	"github.com/zerobotlabs/relax/Godeps/_workspace/src/github.com/onsi/gomega/ghttp"
	"net/http"

	"github.com/zerobotlabs/relax/Godeps/_workspace/src/github.com/onsi/ginkgo/internal/codelocation"
	Failer "github.com/zerobotlabs/relax/Godeps/_workspace/src/github.com/onsi/ginkgo/internal/failer"
	"time"
)

var _ = Describe("SynchronizedAfterSuiteNode", func() {
	var failer *Failer.Failer
	var node SuiteNode
	var codeLocation types.CodeLocation
	var innerCodeLocation types.CodeLocation
	var outcome bool
	var server *ghttp.Server
	var things []string
	var lock *sync.Mutex

	BeforeEach(func() {
		things = []string{}
		server = ghttp.NewServer()
		codeLocation = codelocation.New(0)
		innerCodeLocation = codelocation.New(0)
		failer = Failer.New()
		lock = &sync.Mutex{}
	})

	AfterEach(func() {
		server.Close()
	})
	"github.com/zerobotlabs/relax/Godeps/_workspace/src/github.com/onsi/gomega/ghttp"
	"net/http"

	"github.com/zerobotlabs/relax/Godeps/_workspace/src/github.com/onsi/ginkgo/internal/codelocation"
	Failer "github.com/zerobotlabs/relax/Godeps/_workspace/src/github.com/onsi/ginkgo/internal/failer"
	"github.com/zerobotlabs/relax/Godeps/_workspace/src/github.com/onsi/ginkgo/types"
	"time"
)

var _ = Describe("SynchronizedBeforeSuiteNode", func() {
	var failer *Failer.Failer
	var node SuiteNode
	var codeLocation types.CodeLocation
	var innerCodeLocation types.CodeLocation
	var outcome bool
	var server *ghttp.Server

	BeforeEach(func() {
		server = ghttp.NewServer()
		codeLocation = codelocation.New(0)
		innerCodeLocation = codelocation.New(0)
		failer = Failer.New()
	})

	AfterEach(func() {
		server.Close()
	})

	newNode := func(bodyA interface{}, bodyB interface{}) SuiteNode {
		return NewSynchronizedBeforeSuiteNode(bodyA, bodyB, codeLocation, time.Millisecond, failer)
	}