func main() { conf := wunderground.DefaultConfig(apiKey) w := wunderground.New(conf) printConditions(w) printHourly(w) }
. "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/wfernandes/weather/wunderground/config" ) var _ = Describe("Wunderground", func() { var ( apiKey string conf *config.Config ) BeforeEach(func() { apiKey = "some_api_key" conf = wunderground.DefaultConfig(apiKey) }) Context("Default Config", func() { It("sets the api key and defaults for the HttpClient and api host", func() { Expect(conf.ApiKey).To(Equal(apiKey)) Expect(conf.ApiHost).To(Equal("http://api.wunderground.com")) }) }) Context("Initialization", func() { It("panics if no api key is set in the config", func() { conf.ApiKey = "" Expect(func() { wunderground.New(conf) }).To(Panic()) })