예제 #1
0
		err = listener.Close()
		Expect(err).NotTo(HaveOccurred())
	})

	Describe("the default team", func() {
		Describe("it exists", func() {
			BeforeEach(func() {
				defaultTeam := db.Team{
					Name: atc.DefaultTeamName,
				}
				_, err := database.SaveTeam(defaultTeam)
				Expect(err).NotTo(HaveOccurred())
			})

			It("it does not get duplicated", func() {
				err := database.CreateDefaultTeamIfNotExists()
				Expect(err).NotTo(HaveOccurred())

				team, found, err := database.GetTeamByName(atc.DefaultTeamName)
				Expect(err).NotTo(HaveOccurred())
				Expect(found).To(BeTrue())
				Expect(team.Name).To(Equal(atc.DefaultTeamName))
				Expect(team.Admin).To(BeTrue())
			})

			Context("and it does not have admin permissions", func() {
				It("it sets admin permissions on that team", func() {
					err := database.CreateDefaultTeamIfNotExists()
					Expect(err).NotTo(HaveOccurred())

					team, _, err := database.GetTeamByName(atc.DefaultTeamName)