github.com/kamilchm/hopper@v0.1.1-0.20150901175627-9ee9e15dce47/hopper_test.go (about)

     1  package main
     2  
     3  import (
     4  	. "github.com/smartystreets/goconvey/convey"
     5  	"testing"
     6  
     7  	"io/ioutil"
     8  	"os"
     9  )
    10  
    11  func TestHopper(t *testing.T) {
    12  	Convey("Given empty dir", t, func() {
    13  		testDir := createTestDir()
    14  
    15  		Convey("When we go there", func() {
    16  			os.Chdir(testDir)
    17  
    18  			Convey("We shouldn't be in local mode", func() {
    19  				So(inLocalMode(), ShouldBeFalse)
    20  			})
    21  		})
    22  	})
    23  
    24  	Convey("Given dir with hop.yaml", t, func() {
    25  		testDir := createTestDir()
    26  		ioutil.WriteFile(testDir+"/hop.yaml", []byte(""), 0644)
    27  
    28  		Convey("When we go there", func() {
    29  			os.Chdir(testDir)
    30  
    31  			Convey("We should be in local mode", func() {
    32  				So(inLocalMode(), ShouldBeTrue)
    33  			})
    34  		})
    35  	})
    36  }