Sha256: 2de60eba0e350087b49356fd85fe992fcc73b0bf70e0b0942ba0c2d5063dc3ce

Contents?: true

Size: 1.14 KB

Versions: 19

Compression:

Stored size: 1.14 KB

Contents

require "rubygems"
require "session"

class ExampleSuite
  attr_reader :bash
  def initialize
    @bash = Session::Bash.new
  end

  def run
    run_core_examples
    run_rspec_examples
    run_test_unit_examples
  end

  def run_core_examples
    run_suite("#{dir}/core_spec_suite.rb #{spec_opts}") || raise("Core suite Failed")
  end

  def run_rspec_examples
    run_suite("#{dir}/rspec_spec_suite.rb #{spec_opts}") || raise("Rspec suite Failed")
  end

  def run_test_unit_examples
    run_suite("#{dir}/test_unit_spec_suite.rb") || raise("Test::Unit suite Failed")
  end

  def run_suite(path)
    # From http://www.eglug.org/node/946
    bash.execute "exec 3>&1", :out => STDOUT, :err => STDERR
    bash.execute "ruby -W #{path} 2>&1 >&3 3>&- | grep -v 'warning: useless use of' 3>&-; STATUS=${PIPESTATUS[0]}", :out => STDOUT, :err => STDERR
    status = bash.execute("echo $STATUS")[0].to_s.strip.to_i
    bash.execute "exec 3>&-", :out => STDOUT, :err => STDERR
    return status == 0
  end

  def spec_opts
    File.read("#{dir}/spec.opts").split("\n").join(" ")
  end

  def dir
    File.dirname(__FILE__)
  end
end

if $0 == __FILE__
  ExampleSuite.new.run
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/rr-1.0.2/spec/spec_suite.rb
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/rr-1.0.2/spec/spec_suite.rb
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/rr-1.0.2/spec/spec_suite.rb
vim-jar-0.1.2 bundler/ruby/1.8/gems/rr-1.0.2/spec/spec_suite.rb
vim-jar-0.1.1 bundler/ruby/1.8/gems/rr-1.0.2/spec/spec_suite.rb
vim-jar-0.1.0 bundler/ruby/1.8/gems/rr-1.0.2/spec/spec_suite.rb
vim-jar-0.0.3 bundler/ruby/1.8/gems/rr-1.0.2/spec/spec_suite.rb
vim-jar-0.0.2 bundler/ruby/1.8/gems/rr-1.0.2/spec/spec_suite.rb
vim-jar-0.0.1 bundler/ruby/1.8/gems/rr-1.0.2/spec/spec_suite.rb
rr-1.0.2 spec/spec_suite.rb
rr-1.0.1 spec/spec_suite.rb
rr-1.0.0 spec/spec_suite.rb
rr-0.10.11 spec/spec_suite.rb
rr-0.10.10 spec/spec_suite.rb
rr-0.10.9 spec/spec_suite.rb
rr-0.10.8 spec/spec_suite.rb
rr-0.10.7 spec/spec_suite.rb
rr-0.10.6 spec/spec_suite.rb
rr-0.10.5 spec/spec_suite.rb