Sha256: 0e47d78a8ef3d020c1750fab2888c36ded377d77ba0dd7908353504409cce038

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

require 'base_test'
require 'mocha'
require 'open3'

module ExecutionStrategy
  class TestOpen_3 < BaseTest
    include Methadone::ExecutionStrategy

    test_that "run_command proxies to Open3.capture3" do
      Given {
        @command = any_string
        @stdout = any_string
        @stderr = any_string
        @status = stub('Process::Status')
      }
      When the_test_runs
      Then {
        Open3.expects(:capture3).with(@command).returns([@stdout,@stderr,@status])
      }

      Given new_open_3_strategy
      When {
        @results = @strategy.run_command(@command)
      }
      Then {
        @results[0].should == @stdout
        @results[1].should == @stderr
        @results[2].should be @status
      }
    end

    test_that "exception_meaning_command_not_found returns Errno::ENOENT" do
      Given new_open_3_strategy
      When {
        @klass = @strategy.exception_meaning_command_not_found
      }
      Then {
        @klass.should == Errno::ENOENT
      }
    end

  private
    def new_open_3_strategy
      lambda { @strategy = Open_3.new }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
methadone-1.1.0 test/execution_strategy/test_open_3.rb
methadone-1.0.0 test/execution_strategy/test_open_3.rb
methadone-1.0.0.rc6 test/execution_strategy/test_open_3.rb
methadone-1.0.0.rc5 test/execution_strategy/test_open_3.rb
methadone-1.0.0.rc4 test/execution_strategy/test_open_3.rb
methadone-1.0.0.rc3 test/execution_strategy/test_open_3.rb
methadone-1.0.0.rc2 test/execution_strategy/test_open_3.rb
methadone-1.0.0.rc1 test/execution_strategy/test_open_3.rb