class Buildr::RSpec

<a href=“RSpecrspec.info”>RSpec> is the defacto BDD framework for ruby. To test your project with RSpec use:

test.using :rspec

Support the following options:

Constants

OPTIONS
TESTS_PATTERN

Public Instance Methods

runner_config() click to toggle source
# File lib/buildr/java/bdd.rb, line 241
def runner_config
  runner = super
  runner.gems.update 'rspec' => '~> 2.9.0'
  runner.requires.unshift 'rspec'
  runner
end
runner_content(binding) click to toggle source
# File lib/buildr/java/bdd.rb, line 248
def runner_content(binding)
  runner_erb = %q{
    <%= jruby_gem %>
    <%= dependencies.inspect %>.each { |dep| $CLASSPATH << dep }
    <%= runner.gems.inspect %>.each { |ary| JRuby.gem(*ary.flatten) }
    <%= runner.requires.inspect %>.each { |rb| Kernel.require rb }
    <% if runner.output == false %>
      output = StringIO.new
    <% elsif runner.output.kind_of?(String) %>
      output = File.open(<%= result.output.inspect %>, 'w')
    <% else %>
      output = STDOUT
    <% end %>
    parser = ::RSpec::Core::Parser.new
    argv = <%= runner.rspec.inspect %> || []
    argv.push *<%= tests.inspect %>

    Buildr::TestFramework::TestResult::Error.guard('<%= runner.result %>') do
      ::RSpec::Core::CommandLine.new(argv).run(output, output)
    end
    exit 0 # let buildr figure the result from the yaml file
  }
  Filter::Mapper.new(:erb, binding).transform(runner_erb)
end