Sha256: 2af91caf1c4d279e92ee26a660c67371f86ea04336647ded9e08a15364ffe578

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require "bundler/setup"
require "stringio"
require "fileutils"
require "pd"
require "rag"

$spec_dir = File.expand_path("..", __FILE__)
$spec_data = File.expand_path("../data", __FILE__)
$spec_tmp = File.expand_path("../tmp", __FILE__)

Rc = Rag::Rc
Rc._merge! <<EOF
p:
  root = nil
  home = Pa("#{$spec_data}/home")
  homerc = Pa("#{$spec_data}/ragrc")
  apprc = Pa("#{$spec_data}/apprc")
  data = nil

author = "Test"
email = "test@test.com"
license = "TEST-LICENSE"

github:
  username = "TestYe"
EOF

RSpec.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
  alias :silence :capture

  def chdir(dir, o={}, &blk)
    begin
      cwd = Dir.pwd
      Dir.chdir(dir)
    ensure
      Dir.chdir(cwd)
      if o[:empty]
        FileUtils.rm_r Dir.entries(dir).tap{|v| v.delete("."); v.delete(".."); v.delete(".gitkeep")}
      end
    end
  end

end

module Kernel 
private

  def xdescribe(*args, &blk)
    describe *args do
      pending "xxxxxxxxx"
    end
  end

  def xcontext(*args, &blk)
    context *args do
      pending "xxxxxxxxx"
    end
  end

  def xit(*args, &blk)
    it *args do
      pending "xxxxxxxx"
    end
  end
end

# vim: ft=ruby

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rag-1.3.0 spec/spec_helper.rb