Beispiel #1
0
			It("should retrieve the child elements of the parent selector", func() {
				repository.Get(target.Selectors{parentSelector, childSelector})
				Expect(firstParentBus.SendCall.BodyJSON).To(MatchJSON(childSelectorJSON))
				Expect(secondParentBus.SendCall.BodyJSON).To(MatchJSON(childSelectorJSON))
			})

			It("should successfully return all of the children", func() {
				Expect(repository.Get(target.Selectors{parentSelector, childSelector})).To(Equal(children))
			})
		})

		Context("when all non-zero-indexed elements are successfully retrieved", func() {
			BeforeEach(func() {
				parentSelector.Index = 1
				parentSelector.Indexed = true
				childSelector.Index = 1
				childSelector.Indexed = true
			})

			It("should retrieve the parent elements using the client", func() {
				repository.Get(target.Selectors{parentSelector, childSelector})
				Expect(client.GetElementsCall.Selector).To(Equal(parentSelector.API()))
			})

			It("should retrieve the child elements of the second parent selector", func() {
				repository.Get(target.Selectors{parentSelector, childSelector})
				Expect(firstParentBus.SendCall.BodyJSON).To(BeEmpty())
				Expect(secondParentBus.SendCall.BodyJSON).To(MatchJSON(childSelectorJSON))
			})