spec/spec_helper.rb in serverspec-0.6.16 vs spec/spec_helper.rb in serverspec-0.6.17

- old
+ new

@@ -9,10 +9,16 @@ module Serverspec module Backend class Exec def run_command(cmd) + cmd = build_command(cmd) + cmd = add_pre_command(cmd) + if @example + @example.metadata[:subject].set_command(cmd) + end + if cmd =~ /invalid/ { :stdout => ::Serverspec.configuration.stdout, :stderr => ::Serverspec.configuration.stderr, :exit_status => 1, @@ -26,16 +32,44 @@ :exit_signal => nil } end end end + + class Ssh + def run_command(cmd) + cmd = build_command(cmd) + cmd = add_pre_command(cmd) + if @example + @example.metadata[:subject].set_command(cmd) + end + + if cmd =~ /invalid/ + { + :stdout => ::Serverspec.configuration.stdout, + :stderr => ::Serverspec.configuration.stderr, + :exit_status => 1, + :exit_signal => nil + } + else + { + :stdout => ::Serverspec.configuration.stdout, + :stderr => ::Serverspec.configuration.stderr, + :exit_status => 0, + :exit_signal => nil + } + end + end + end end module Type class Base + def set_command(command) + @command = command + end def command - cmd = backend.build_command('command') - backend.add_pre_command(cmd) + @command end end end end