Sha256: 8c2ff3d73ecfee0558830b0cd3f3d2a53f2ffeec7a3d6698974828b9752fb4c2

Contents?: true

Size: 962 Bytes

Versions: 2

Compression:

Stored size: 962 Bytes

Contents

require 'wordless/cli'
require 'fakeweb'
require 'thor'

# Set shell to basic
# $0 = "thor"
# $thor_runner = true
# ARGV.clear
# Thor::Base.shell = Thor::Shell::Basic

RSpec.configure do |config|
  FakeWeb.allow_net_connect = false
  
  $stdout = StringIO.new
  
  # Stub Wordless::CLI#wordless_repo to avoid hitting the network when testing Wordless installation
  # FIXME - Need to be able to selectively stub this
  # config.before(:each, :stub_wordless_install => true) do
  #   module Wordless
  #     class CLI
  #       no_tasks do
  #         def wordless_repo
  #           File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'wordless_stub'))
  #         end
  #       end
  #     end
  #   end
  # end
  
  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wordless-0.2.0 spec/spec_helper.rb
wordless-0.1.0 spec/spec_helper.rb