Sha256: b0278335f80c1061100cfa84dfd9b3468bc4ae4d8d4a4cc8c61c339c22e2f467

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

$TESTING=true

$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require 'thor'
require 'thor/group'
require 'stringio'

require 'rubygems'
require 'rdoc'
require 'diff/lcs' # You need diff/lcs installed to run specs (but not to run Thor).

$thor_runner = true

# Load fixtures
load File.join(File.dirname(__FILE__), "fixtures", "task.thor")
load File.join(File.dirname(__FILE__), "fixtures", "group.thor")
load File.join(File.dirname(__FILE__), "fixtures", "script.thor")
load File.join(File.dirname(__FILE__), "fixtures", "invoke.thor")

# Set shell to basic
Thor::Base.shell = Thor::Shell::Basic

Kernel.module_eval do
  alias_method :must, :should
  alias_method :must_not, :should_not
  undef_method :should
  undef_method :should_not
end

Spec::Runner.configure do |config|
  def capture(stream)
    begin
      stream = stream.to_s
      eval "$#{stream} = StringIO.new"
      yield
      result = eval("$#{stream}").string
    ensure 
      eval("$#{stream} = #{stream.upcase}")
    end

    result
  end

  def source_root
    File.join(File.dirname(__FILE__), 'fixtures')
  end

  def destination_root
    File.join(File.dirname(__FILE__), 'sandbox')
  end

  alias :silence :capture
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thor-0.13.3 spec/spec_helper.rb
thor-0.13.2 spec/spec_helper.rb
thor-0.13.1 spec/spec_helper.rb
thor-0.13.0 spec/spec_helper.rb