github.com/cloudfoundry-attic/ltc@v0.0.0-20151123212628-098adc7919fc/cluster_test/command_factory/cluster_test_command_factory_test.go (about) 1 package command_factory_test 2 3 import ( 4 "time" 5 6 . "github.com/onsi/ginkgo" 7 . "github.com/onsi/gomega" 8 9 "github.com/cloudfoundry-incubator/ltc/cluster_test/command_factory" 10 "github.com/cloudfoundry-incubator/ltc/cluster_test/fake_cluster_test_runner" 11 "github.com/cloudfoundry-incubator/ltc/test_helpers" 12 "github.com/codegangsta/cli" 13 ) 14 15 var _ = Describe("ClusterTestCommandFactory", func() { 16 var fakeClusterTestRunner *fake_cluster_test_runner.FakeClusterTestRunner 17 18 BeforeEach(func() { 19 fakeClusterTestRunner = &fake_cluster_test_runner.FakeClusterTestRunner{} 20 }) 21 22 Describe("MakeClusterTestCommand", func() { 23 var clusterTestCommand cli.Command 24 25 BeforeEach(func() { 26 commandFactory := command_factory.NewClusterTestCommandFactory(fakeClusterTestRunner) 27 clusterTestCommand = commandFactory.MakeClusterTestCommand() 28 }) 29 30 It("prints the integration test run output and args", func() { 31 args := []string{"--timeout=50s", "--verbose=true"} 32 test_helpers.ExecuteCommandWithArgs(clusterTestCommand, args) 33 34 Expect(fakeClusterTestRunner.RunCallCount()).To(Equal(1)) 35 timeoutArg, verboseArg := fakeClusterTestRunner.GetArgsForRun() 36 Expect(timeoutArg).To(Equal(time.Second * 50)) 37 Expect(verboseArg).To(BeTrue()) 38 }) 39 40 It("has sane defaults", func() { 41 test_helpers.ExecuteCommandWithArgs(clusterTestCommand, []string{}) 42 43 Expect(fakeClusterTestRunner.RunCallCount()).To(Equal(1)) 44 timeoutArg, verboseArg := fakeClusterTestRunner.GetArgsForRun() 45 Expect(timeoutArg).To(Equal(time.Minute * 5)) 46 Expect(verboseArg).To(BeFalse()) 47 }) 48 }) 49 })