コード例 #1
0
ファイル: file_store_test.go プロジェクト: pivotal/gumshoe
	. "github.com/pivotal/gumshoe/repos/ginkgo"
	. "github.com/pivotal/gumshoe/repos/gomega"
	"github.com/pivotal/gumshoe/trackerapi/store"
)

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

	var (
		fileStore *store.FileStore
		tempFile  *os.File
	)

	BeforeEach(func() {
		tempFile, _ = ioutil.TempFile("", ".tracker")
		fileStore = store.NewFileStore()
		fileStore.SetFilePath(tempFile.Name())
	})

	AfterEach(func() {
		fileStore.Clear()
	})

	It("stores arbitrary key-value pairs", func() {
		key := "Ryan Gosling"
		value := "Hey girl, I heard you like reading... Maybe you could read my lips."
		fileStore.Set(key, value)
		retVal, _ := fileStore.Get(key)
		Expect(retVal).To(Equal(value))
	})
コード例 #2
0
ファイル: client.go プロジェクト: pivotal/gumshoe
func NewConfiguration() Configuration {
	return Configuration{
		Store:    store.NewFileStore(),
		Resolver: request.NewDefaultResolver(),
	}
}