Beispiel #1
0
			})
		})

		Context("when the plugin contains a command that another installed plugin contains", func() {
			BeforeEach(func() {
				pluginsMap := make(map[string]plugin_config.PluginMetadata)
				pluginsMap["Test1Collision"] = plugin_config.PluginMetadata{
					Location: "location/to/config.exe",
					Commands: []plugin.Command{
						{
							Name:     "test_1_cmd1",
							HelpText: "Hi!",
						},
					},
				}
				config.PluginsReturns(pluginsMap)
			})

			It("fails", func() {
				runCommand(test_1)

				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"`test_1_cmd1` is a command in plugin 'Test1Collision'.  You could try uninstalling plugin 'Test1Collision' and then install this plugin in order to invoke the `test_1_cmd1` command.  However, you should first fully understand the impact of uninstalling the existing 'Test1Collision' plugin."},
					[]string{"FAILED"},
				))
			})
		})

		It("plugin binary argument is a bad file path", func() {
			runCommand("path/to/not/a/thing.exe")
Beispiel #2
0
	BeforeEach(func() {
		ui = &testterm.FakeUI{}
		requirementsFactory = &testreq.FakeReqFactory{}
		config = &testconfig.FakePluginConfiguration{}

		rpc.DefaultServer = rpc.NewServer()
	})

	runCommand := func(args ...string) bool {
		cmd := NewPlugins(ui, config)
		return testcmd.RunCommand(cmd, args, requirementsFactory)
	}

	It("fails if the plugin cannot be started", func() {
		config.PluginsReturns(map[string]plugin_config.PluginMetadata{
			"test_245":     plugin_config.PluginMetadata{},
			"anotherThing": plugin_config.PluginMetadata{},
		})

		runCommand()
		Expect(ui.Outputs).ToNot(ContainSubstrings(
			[]string{"test_245"},
			[]string{"anotherThing"},
		))
	})

	It("returns a list of available methods of a plugin", func() {
		config.PluginsReturns(map[string]plugin_config.PluginMetadata{
			"Test1": plugin_config.PluginMetadata{Location: "../../../fixtures/plugins/test_1.exe", Commands: []plugin.Command{{Name: "test_1_cmd1"}, {Name: "test_1_cmd2"}}},
		})

		runCommand()