Sha256: 6a64d10af6dcc1798262e8c0c6f499957e9d831a4bdc4efecfe702d75f2f2e08
Contents?: true
Size: 1.78 KB
Versions: 7
Compression:
Stored size: 1.78 KB
Contents
require 'serverspec' require 'pathname' require 'rspec/mocks/standalone' PROJECT_ROOT = (Pathname.new(File.dirname(__FILE__)) + '..').expand_path Dir[PROJECT_ROOT.join("spec/support/**/*.rb")].each { |file| require(file) } 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, :exit_signal => nil } else { :stdout => ::Serverspec.configuration.stdout, :stderr => ::Serverspec.configuration.stderr, :exit_status => 0, :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 @command end end end end
Version data entries
7 entries across 7 versions & 1 rubygems