var _ = Describe("CFDroplet", func() {
	var fakeCliConnection *cliFakes.FakeCliConnection
	var droplet *CFDroplet
	var fakeDownloader *fakes.FakeDownloader

	BeforeEach(func() {
		fakeCliConnection = &cliFakes.FakeCliConnection{}
		fakeDownloader = &fakes.FakeDownloader{}
		droplet = NewCFDroplet(fakeCliConnection, fakeDownloader)
		Ω(droplet.Cli).Should(Equal(fakeCliConnection))
		Ω(droplet.GetDownloader()).ShouldNot(BeNil())
	})

	Describe("Getting the app details from cf", func() {
		BeforeEach(func() {
			fakeCliConnection.GetAppReturns(plugin_models.GetAppModel{Guid: "1234"}, nil)
		})

		It("Should call the plugin service to get the app", func() {
			err := droplet.SaveDroplet("foo", "/tmp")
			Ω(fakeCliConnection.GetAppArgsForCall(0)).Should(Equal("foo"))
			Ω(fakeCliConnection.GetAppCallCount()).To(Equal(1))
			Ω(err).Should(BeNil())
		})
	})

	Describe("Getting app details from cf failure scinerieos", func() {
		BeforeEach(func() {
			fakeCliConnection.GetAppReturns(plugin_models.GetAppModel{},
				errors.New("Bad Things"))
		})