Sha256: 98c7df0a3b7b2f16188a8d3c10f2442f06c47e8c65aff698322c07b0b724d334

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

require 'bundler'
Bundler.setup

require 'rspec'

$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)

require 'handbrake'

RSpec.configure do |config|
  # Captures everything printed to stdout during the block
  # and returns it as a string.
  def capture_stdout
    old_stdout, $stdout = $stdout, StringIO.new
    begin
      yield
      $stdout.string
    ensure
      $stdout = old_stdout
    end
  end

  def tmpdir(sub=nil)
    @tmpdir ||= begin
                  dirname = File.expand_path("../tmp", __FILE__)
                  mkdir_p dirname
                  dirname
                end
    if sub
      full = File.join(@tmpdir, sub)
      mkdir_p full
      full
    else
      @tmpdir
    end
  end
end

module HandBrake
  module Spec
    ##
    # A stub implementation of the runner for HandBrake::CLI.
    class StaticRunner
      attr_accessor :output, :status
      attr_reader :actual_arguments

      def run(args)
        @actual_arguments = args
        HandBrake::CLI::RunnerResult.new(output, status)
      end

      def status
        @status ||= 0
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
handbrake-0.1.0 spec/spec_helper.rb
handbrake-0.0.2 spec/spec_helper.rb
handbrake-0.0.1 spec/spec_helper.rb