예제 #1
0
		csvStore = NewCsvStore("/tmp/fakecsvstore")
		redisStore = NewCsvStore("/tmp/fakeredisstore")
		CsvStoreFactory = func(dir string) laboratory.Store {
			csvStoreDir = dir
			return csvStore
		}
		RedisStoreFactory = func(host string, port int, password string) (laboratory.Store, error) {
			redisHost = host
			redisPort = port
			redisPassword = password
			return redisStore, nil
		}
	})

	JustBeforeEach(func() {
		flags.Parse(args)
	})

	Context("When useRedis is false", func() {
		BeforeEach(func() {
			args = []string{"-use-redis=false", "-csv-dir", "foo/bar/baz"}
		})

		It("Uses the csvDir paramter to configure a CSV store", func() {
			var s laboratory.Store = nil
			WithStore(func(store laboratory.Store) error {
				s = store
				return nil
			})

			Ω(s).Should(Equal(csvStore))
예제 #2
0
		)

		BeforeEach(func() {
			flags = config.NewConfig()
			os.Clearenv()
			InitCommandLineFlags(flags)
			ListenAndServe = func(bind string) error {
				listen = bind
				return nil
			}
		})

		Context("When VCAP_APP_PORT does not exist", func() {
			BeforeEach(func() {
				os.Clearenv()
				flags.Parse([]string{})
			})

			It("Defaults to 8080", func() {
				Bind()
				Ω(listen).Should(Equal(":8080"))
			})
		})

		Context("When VCAP_APP_PORT exists", func() {
			BeforeEach(func() {
				os.Setenv("VCAP_APP_PORT", "1234")
				flags.Parse([]string{})
			})

			It("Uses the env variable", func() {