Class: Buildr::JBehave
- Defined in:
- lib/buildr/java/bdd.rb
Overview
JBehave is a Java BDD framework. To use in your project:
test.using :jbehave
This framework will search in your project for:
src/spec/java/**/*Behaviour.java
JMock libraries are included on runtime.
Support the following options:
-
:properties – Hash of properties to the test suite
-
:java_args – Arguments passed to the JVM
Constant Summary collapse
- VERSION =
'1.0.1'
- TESTS_PATTERN =
:nodoc:
[ /Behaviou?r$/ ]
Class Method Summary collapse
Instance Method Summary collapse
-
#run(tests, dependencies) ⇒ Object
:nodoc:.
-
#tests(dependencies) ⇒ Object
:nodoc:.
Class Method Details
.applies_to?(project) ⇒ Boolean
:nodoc:
426 427 428 429 430 |
# File 'lib/buildr/java/bdd.rb', line 426 def applies_to?(project) #:nodoc: %w{ **/*Behaviour.java **/*Behavior.java }.any? { |glob| !Dir[project.path_to(:source, bdd_dir, lang, glob)].empty? } end |
.dependencies ⇒ Object
417 418 419 420 421 422 423 424 |
# File 'lib/buildr/java/bdd.rb', line 417 def dependencies unless @dependencies super @dependencies |= ["org.jbehave:jbehave:jar:#{version}", 'cglib:cglib-full:jar:2.0.2'] + JMock.dependencies + JUnit.dependencies end @dependencies end |
Instance Method Details
#run(tests, dependencies) ⇒ Object
:nodoc:
445 446 447 448 449 450 451 452 453 454 455 456 |
# File 'lib/buildr/java/bdd.rb', line 445 def run(tests, dependencies) #:nodoc: cmd_args = ['org.jbehave.core.BehaviourRunner'] = { :properties=>[:properties], :java_args=>[:java_args], :classpath=>dependencies } tests.inject([]) do |passed, test| begin Java::Commands.java cmd_args, test, passed << test rescue passed end end end |
#tests(dependencies) ⇒ Object
:nodoc:
440 441 442 443 |
# File 'lib/buildr/java/bdd.rb', line 440 def tests(dependencies) #:nodoc: filter_classes(dependencies, :class_names => TESTS_PATTERN, :interfaces => %w{ org.jbehave.core.behaviour.Behaviours }) end |