Permalink
Browse files

added delegator for builder methods

  • Loading branch information...
leoc committed May 24, 2012
1 parent 220f997 commit 2c80c877337d81074620c80a7a6e6b3db22f3cd3
Showing with 14 additions and 0 deletions.
  1. +3 −0 lib/em-systemcommand.rb
  2. +11 −0 spec/em-systmcommand_spec.rb
View
@@ -9,6 +9,9 @@ module EventMachine
class SystemCommand
include EM::SystemCommand::PipeHandler
include EM::Deferrable
+ extend Forwardable
+
+ def_delegators :@command, :<<, :add
pipe_handler :stdin, EM::SystemCommand::Pipe
pipe_handler :stdout, EM::SystemCommand::Pipe
@@ -82,6 +82,17 @@
end
end
+ it 'should proxy builder commands' do
+ EM.run do
+ cmd = EM::SystemCommand.new 'echo'
+ cmd << '-n'
+ cmd.add 'Something\n'
+ cmd.execute
+ EM.stop_event_loop
+ end
+ end
+
+
describe 'subclass' do
before :all do
class DummyCmd < EM::SystemCommand;end

0 comments on commit 2c80c87

Please sign in to comment.