BeforeEach(func() { u = domain.User{} u.SetAuthenticator(&FakeAuthenticator{APIToken: "abcde12345"}) }) It("stores the Username and Password", func() { u.Login("mister_tee", "sekret") Expect(u.Username).To(Equal("mister_tee")) Expect(u.Password).To(Equal("sekret")) }) Describe("IsAuthenticated", func() { It("returns the authenticated state of the user object", func() { u.APIToken = "abcde" Expect(u.IsAuthenticated()).To(BeTrue()) u.APIToken = "" Expect(u.IsAuthenticated()).To(BeFalse()) }) }) Describe("HasCredentials", func() { It("returns a boolean if username or password are empty", func() { Expect(u.HasCredentials()).To(BeFalse()) u.Username = "******" Expect(u.HasCredentials()).To(BeFalse()) u.Password = "******" Expect(u.HasCredentials()).To(BeTrue()) }) })