Example #1
0
	. "github.com/pivotal/gumshoe/repos/gomega"
	"github.com/pivotal/gumshoe/trackerapi"
	"github.com/pivotal/gumshoe/trackerapi/request"
	"github.com/pivotal/gumshoe/trackerapi/store"
)

var _ = Describe("Client", func() {
	var (
		json   string
		client *trackerapi.Client
		ts     *TestServer
	)

	BeforeEach(func() {
		config := trackerapi.NewConfiguration()
		config.Store = store.NewMemoryStore()
		config.Store.Set("APIToken", "abcde90792f3898ab464cd3412345")
		client, _ = trackerapi.NewClient(config)
	})

	AfterEach(func() {
		client.Cleanup()
		ts.Close()
	})

	Describe("Me", func() {
		BeforeEach(func() {
			json = `{
                "api_token": "abcde90792f3898ab464cd3412345",
                "name": "Mister Tee",
                "kind": "me",
Example #2
0
package store_test

import (
	. "github.com/pivotal/gumshoe/repos/ginkgo"
	. "github.com/pivotal/gumshoe/repos/gomega"
	"github.com/pivotal/gumshoe/trackerapi/store"
)

var _ = Describe("MemoryStore", func() {

	var memoryStore *store.MemoryStore

	BeforeEach(func() {
		memoryStore = store.NewMemoryStore()
	})

	It("stores arbitrary key-value pairs", func() {
		key := "Ryan Gosling"
		value := "Hey girl, I heard you like reading... Maybe you could read my lips."
		memoryStore.Set(key, value)
		retVal, _ := memoryStore.Get(key)
		Expect(retVal).To(Equal(value))
	})

	It("does not persist the key-value pairs across store instances", func() {
		key := "Ryan Gosling"
		value := "Hey girl, I heard you like reading... Maybe you could read my lips."
		memoryStore.Set(key, value)
		retVal, _ := memoryStore.Get(key)
		Expect(retVal).To(Equal(value))