<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:
:gems – A hash of gems to install before running the tests.
The keys of this hash are the gem name, the value must be the required version.
:requires – A list of ruby files to require before running the specs
Mainly used if an rspec format needs to require some file.
:format – A list of valid Rspec –format option values. (defaults to ‘progress’)
:output – File path to output dump. @false@ to suppress output
:fork – Create a new JavaVM to run the tests on
:properties – Hash of properties passed to the test suite.
:java_args – Arguments passed to the JVM.
# 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
# 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