Esempio n. 1
0
)

var _ = Describe("User", func() {
	var u *user.User

	BeforeEach(func() {
		var err error
		u, err = user.New()
		Expect(err).NotTo(HaveOccurred())
	})

	Describe("Full Name", func() {
		Context("With a first and last name", func() {
			It("should concatenate the names with a ' '", func() {
				u.FirstName = "Peyton"
				u.LastName = "Manning"
				Expect(u.FullName()).To(Equal("Peyton Manning"))
			})
		})

		Context("With only a first name", func() {
			It("should return the first name", func() {
				u.FirstName = "Peyton"
				Expect(u.FullName()).To(Equal("Peyton"))
			})
		})

		Context("With only a last name", func() {
			It("should return the last name", func() {
				u.LastName = "Manning"
				Expect(u.FullName()).To(Equal("Manning"))