func loadConfiguration(c *cli.Context) (config *configuration.InductorConfiguration, err error) { configFile, err := os.Open(c.String("config")) if err != nil { return nil, err } defer func() { if cerr := configFile.Close(); cerr != nil { err = cerr } }() return configuration.New(configFile) }
import ( "strings" "github.com/joefitzgerald/inductor/configuration" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Configuration", func() { var ( err error config *configuration.InductorConfiguration ) BeforeEach(func() { config, err = configuration.New(strings.NewReader(testData)) Expect(err).NotTo(HaveOccurred()) }) It("should show the gui", func() { Expect(config.Headless).To(BeFalse()) }) It("should skip windows updates", func() { Expect(config.WindowsUpdates).To(BeFalse()) }) It("should use the SSH communicator", func() { Expect(config.Communicator).To(Equal("ssh")) }) It("should have an output dir of /tmp/foo/bar", func() { Expect(config.OutDir).To(Equal("/tmp/foo/bar")) }) It("should have a username of admin", func() {