Sha256: 31c9cbfcf05add09bab7a09684b5e0b5a286d0357816c47d4b934159643ad9ec

Contents?: true

Size: 723 Bytes

Versions: 10

Compression:

Stored size: 723 Bytes

Contents

require 'fileutils'

module TestHelper

def create_rim_info(dir, attrs)
  FileUtils.mkdir_p dir
  ri = RIM::RimInfo.new
  attrs.each_pair do |k,v|
    ri.send("#{k}=", v)
  end
  ri.to_dir(dir)
end

def empty_test_dir(dir)
  # create directory in test folder
  dir = File.dirname(__FILE__)+"/"+dir
  rm_rf(dir)
  mkdir_p(dir)
  ENV["RIM_HOME"] = File.join(dir, ".rim") if @test_dirs.nil?
  @test_dirs ||= []
  @test_dirs << dir
  dir
end

def write_file(path, content)
  FileUtils.mkdir_p File.dirname(path)
  File.open(path, "w") do |f| 
    f.write content
  end
end

def remove_test_dirs
  @test_dirs ||= []
  @test_dirs.each do |d|
    rm_rf(d)
  end
  @test_dirs = nil
end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
esr-rim-1.4.8 test/test_helper.rb
esr-rim-1.4.7 test/test_helper.rb
esr-rim-1.4.4 test/test_helper.rb
esr-rim-1.4.3 test/test_helper.rb
esr-rim-1.4.2 test/test_helper.rb
esr-rim-1.4.0 test/test_helper.rb
esr-rim-1.3.9 test/test_helper.rb
esr-rim-1.3.8 test/test_helper.rb
esr-rim-1.3.7 test/test_helper.rb
esr-rim-1.3.6 test/test_helper.rb