"region": "some-aws-region"
						}
					}`), os.ModePerm)
					Expect(err).NotTo(HaveOccurred())
				})

				AfterEach(func() {
					storage.ResetRename()
				})

				It("renames state.json to bbl-state.json and returns its state", func() {
					state, err := storage.GetState(tempDir)
					Expect(err).NotTo(HaveOccurred())

					_, err = os.Stat(filepath.Join(tempDir, "state.json"))
					Expect(err).To(gomegamatchers.BeAnOsIsNotExistError())

					_, err = os.Stat(filepath.Join(tempDir, "bbl-state.json"))
					Expect(err).NotTo(HaveOccurred())

					Expect(state).To(Equal(storage.State{
						Version: 1,
						AWS: storage.AWS{
							AccessKeyID:     "some-aws-access-key-id",
							SecretAccessKey: "some-aws-secret-access-key",
							Region:          "some-aws-region",
						},
					}))
					Expect(logger.PrintlnCall.CallCount).To(Equal(1))
					Expect(logger.PrintlnCall.Receives.Message).To(Equal("renaming state.json to bbl-state.json"))
				})
package gomegamatchers_test

import (
	"errors"
	"os"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/pivotal-cf-experimental/gomegamatchers"
)

var _ = Describe("OsIsNotExistMatcher", func() {
	It("asserts if an error is an os.IsNotExist error", func() {
		Expect(os.ErrNotExist).To(gomegamatchers.BeAnOsIsNotExistError())
		Expect(errors.New("foo")).ToNot(gomegamatchers.BeAnOsIsNotExistError())
	})

	It("errors when not passed an error", func() {
		var foo error
		_, err := gomegamatchers.BeAnOsIsNotExistError().Match(foo)
		Expect(err).To(MatchError("BeAnOsIsNotExistError matcher expects an error, got <nil>"))
	})
})