Sha256: 00ea94e2f440552de241d357c33a4baf0e7339f3e0752c541da1e7e222578599

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require 'wordpress_tools/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
  
  FileUtils.mkdir('tmp') unless File.directory? 'tmp'
  
  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

1 entries across 1 versions & 1 rubygems

Version Path
wordpress_tools-0.0.1 spec/spec_helper.rb