Expect(resp).To(Equal("ok")) Expect(settingsService.SettingsWereInvalidated).To(BeTrue()) }) Context("when settings invalidation succeeds", func() { It("prepares platform for networking change", func() { resp, err := action.Run() Expect(err).NotTo(HaveOccurred()) Expect(resp).To(Equal("ok")) Expect(platform.PrepareForNetworkingChangeCalled).To(BeTrue()) }) It("returns error if preparing for networking change fails", func() { platform.PrepareForNetworkingChangeErr = errors.New("fake-prepare-error") resp, err := action.Run() Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-prepare-error")) Expect(resp).To(Equal("")) }) }) Context("when settings invalidation fails", func() { BeforeEach(func() { settingsService.InvalidateSettingsError = errors.New("fake-invalidate-error") }) It("returns error early if settings err invalidating", func() {