github.com/jghiloni/cli@v6.28.1-0.20170628223758-0ce05fe032a2+incompatible/integration/isolated/table_alignment_test.go (about)

     1  package isolated
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/integration/helpers"
     5  	. "github.com/onsi/ginkgo"
     6  	. "github.com/onsi/gomega"
     7  	. "github.com/onsi/gomega/gbytes"
     8  	. "github.com/onsi/gomega/gexec"
     9  )
    10  
    11  var _ = Describe("table alignment", func() {
    12  	BeforeEach(func() {
    13  		helpers.LoginCF()
    14  	})
    15  
    16  	Context("when output is in English", func() {
    17  		BeforeEach(func() {
    18  			setupCF(ReadOnlyOrg, ReadOnlySpace)
    19  		})
    20  
    21  		// Developer note: The spacing in this test is significant and explicit. Do
    22  		// not replace with a regex.
    23  		It("aligns the table correctly", func() {
    24  			username, _ := helpers.GetCredentials()
    25  			session := helpers.CF("target")
    26  			Eventually(session.Out).Should(Say("api endpoint:   %s", apiURL))
    27  			Eventually(session.Out).Should(Say(`api version:    [\d.]+`))
    28  			Eventually(session.Out).Should(Say("user:           %s", username))
    29  			Eventually(session.Out).Should(Say("org:            %s", ReadOnlyOrg))
    30  			Eventually(session.Out).Should(Say("space:          %s", ReadOnlySpace))
    31  			Eventually(session).Should(Exit(0))
    32  		})
    33  	})
    34  
    35  	Context("when output is in language with multibyte characters", func() {
    36  		BeforeEach(func() {
    37  			setupCF(ReadOnlyOrg, ReadOnlySpace)
    38  		})
    39  
    40  		// Developer note: The spacing in this test is significant and explicit. Do
    41  		// not replace with a regex.
    42  		It("aligns the table correctly", func() {
    43  			username, _ := helpers.GetCredentials()
    44  			session := helpers.CFWithEnv(map[string]string{"LANG": "ja-JP.utf8"}, "target")
    45  			Eventually(session.Out).Should(Say("API エンドポイント:   %s", apiURL))
    46  			Eventually(session.Out).Should(Say("api version:          [\\d.]+"))
    47  			Eventually(session.Out).Should(Say("ユーザー:             %s", username))
    48  			Eventually(session.Out).Should(Say("組織:                 %s", ReadOnlyOrg))
    49  			Eventually(session.Out).Should(Say("スペース:             %s", ReadOnlySpace))
    50  			Eventually(session).Should(Exit(0))
    51  		})
    52  	})
    53  })