Esempio n. 1
0
					"endpoint1": "host1",
					"endpoint2": "host2",
					"endpoint3": "host3",
				},
				"deeply": map[string]interface{}{
					"nested": map[string]interface{}{
						"thing": "foo",
					},
					"foo": "bar",
				},
			},
		)
	})
	Describe("log", func() {
		It("Should log to StdLogger when cast fails", func() {
			result := opts.Int("string")
			Expect(log.GetEntry()).To(Equal("Unable to Cast \"one\" to int for key 'string'|"))
			Expect(result).To(Equal(0))
		})
	})
	Describe("Int()", func() {
		It("Should convert values to integers", func() {
			result := opts.Int("int")
			Expect(log.GetEntry()).To(Equal(""))
			Expect(result).To(Equal(1))
		})
		It("Should return default value if key doesn't exist", func() {
			result := opts.Int("none")
			Expect(log.GetEntry()).To(Equal(""))
			Expect(result).To(Equal(0))
		})