github.com/elopio/cli@v6.21.2-0.20160902224010-ea909d1fdb2f+incompatible/utils/config/config_suite_test.go (about)

     1  package config_test
     2  
     3  import (
     4  	"io/ioutil"
     5  	"os"
     6  	"path/filepath"
     7  
     8  	. "github.com/onsi/ginkgo"
     9  	. "github.com/onsi/gomega"
    10  
    11  	"testing"
    12  )
    13  
    14  func TestConfig(t *testing.T) {
    15  	RegisterFailHandler(Fail)
    16  	RunSpecs(t, "Config Suite")
    17  }
    18  
    19  func setConfig(homeDir string, rawConfig string) {
    20  	err := os.MkdirAll(filepath.Join(homeDir, ".cf"), 0777)
    21  	Expect(err).ToNot(HaveOccurred())
    22  	err = ioutil.WriteFile(filepath.Join(homeDir, ".cf", "config.json"), []byte(rawConfig), 0644)
    23  	Expect(err).ToNot(HaveOccurred())
    24  }
    25  
    26  func setPluginConfig(pluginDir string, rawConfig string) {
    27  	err := os.MkdirAll(filepath.Join(pluginDir), 0777)
    28  	Expect(err).ToNot(HaveOccurred())
    29  	err = ioutil.WriteFile(filepath.Join(pluginDir, "config.json"), []byte(rawConfig), 0644)
    30  	Expect(err).ToNot(HaveOccurred())
    31  }