Sha256: c59a056d9c8e6913f81e407631c40a2f85daf4dd87543b7739244d0abaa3b40d

Contents?: true

Size: 978 Bytes

Versions: 16

Compression:

Stored size: 978 Bytes

Contents

def benchmark(*args, &block)
  if ENV['BENCHMARK']
    Benchmark.bmbm(*args, &block)
  end
end

# given "filename.ext" returns "filename.CHECK.ext
# block can be given to sanitize each string
def file_check(filename, delete=true, &block)
  ext = File.extname(filename)
  base = filename.chomp(ext)
  checkfile = base + ".CHECK" + ext
  File.exist?(filename).should be_true
  fstring = IO.read(filename)
  cstring = IO.read(checkfile)
  if block
    (fstring, cstring) = [fstring, cstring].map do |string|
      block.call(string)
    end
  end
  fstring.should == cstring
  File.unlink(filename) if delete
end

def sanitize_mspire_version_xml(string)
  string.gsub(/"mspire(_[\d\.]+)?" version="([\.\d]+)"/, %Q{"mspire" version="X.X.X"})
  .gsub(/softwareRef="mspire_[\d\.]+/, 'softwareRef="mspire_X.X.X')
end

require 'stringio'
 
module Kernel
 
  def capture_stdout
    out = StringIO.new
    $stdout = out
    yield
    out.string
  ensure
    $stdout = STDOUT
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mspire-0.10.8.0 spec/spec_utilities.rb
mspire-0.10.7.3 spec/spec_utilities.rb
mspire-0.10.7.2 spec/spec_utilities.rb
mspire-0.10.7.1 spec/spec_utilities.rb
mspire-0.10.7 spec/spec_utilities.rb
mspire-0.10.6 spec/spec_utilities.rb
mspire-0.10.5 spec/spec_utilities.rb
mspire-0.10.4 spec/spec_utilities.rb
mspire-0.10.3 spec/spec_utilities.rb
mspire-0.10.2 spec/spec_utilities.rb
mspire-0.10.1 spec/spec_utilities.rb
mspire-0.10.0 spec/spec_utilities.rb
mspire-0.9.2 spec/spec_utilities.rb
mspire-0.9.1 spec/spec_utilities.rb
mspire-0.9.0 spec/spec_utilities.rb
mspire-0.8.7 spec/spec_utilities.rb