diff --git a/lib/puppet/provider/command.rb b/lib/puppet/provider/command.rb new file mode 100644 index 000000000..8e56aa24a --- /dev/null +++ b/lib/puppet/provider/command.rb @@ -0,0 +1,10 @@ +class Puppet::Provider::Command + def initialize(executable, options = {}) + @executable = executable + @options = options + end + + def execute(executor) + executor.execute([@executable], @options) + end +end diff --git a/spec/unit/provider/command.rb b/spec/unit/provider/command.rb new file mode 100755 index 000000000..7f1b21d58 --- /dev/null +++ b/spec/unit/provider/command.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +require 'puppet/provider/command' + +describe Puppet::Provider::Command do + let(:executor) { mock('executor') } + + it "exectutes a simple command" do + executor.expects(:execute).with(["/foo"], {}) + + command = Puppet::Provider::Command.new("/foo") + command.execute(executor) + end + + it "exectutes a command with extra options" do + executor.expects(:execute).with(["/foo"], { :option => 1}) + + command = Puppet::Provider::Command.new("/foo", { :option => 1 }) + command.execute(executor) + end +end