Sha256: d773dfa5683314cd487efe270ef74972553cd9d4f798e22ed2ae3c52a170bee6

Contents?: true

Size: 687 Bytes

Versions: 1

Compression:

Stored size: 687 Bytes

Contents

require 'shell_mock/monkey_patch'
require 'shell_mock/stub_registry'
require 'shell_mock/no_stub_specified'

module ShellMock
  class BacktickMonkeyPatch < MonkeyPatch
    def method_name
      "`"
    end

    def interpolatable_name
      :backtick
    end

    def override(command)
      stub = StubRegistry.stub_matching({}, command, {})

      if stub
        stub.called_with({}, command, {})

        stub.side_effect.call

        __un_shell_mocked_backtick(stub.to_oneliner)
      else
        if ShellMock.let_commands_run?
          __un_shell_mocked_backtick(command)
        else
          raise NoStubSpecified.new({}, command, {})
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shell_mock-0.5.0 lib/shell_mock/backtick_monkey_patch.rb