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:
413 414 415 416 417 |
# File 'lib/buildr/java/bdd.rb', line 413 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
408 409 410 411 |
# File 'lib/buildr/java/bdd.rb', line 408 def dependencies @dependencies ||= ["org.jbehave:jbehave:jar:#{version}", 'cglib:cglib-full:jar:2.0.2'] + JMock.dependencies + JUnit.dependencies end |
Instance Method Details
#run(tests, dependencies) ⇒ Object
:nodoc:
432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'lib/buildr/java/bdd.rb', line 432 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:
427 428 429 430 |
# File 'lib/buildr/java/bdd.rb', line 427 def tests(dependencies) #:nodoc: filter_classes(dependencies, :class_names => TESTS_PATTERN, :interfaces => %w{ org.jbehave.core.behaviour.Behaviours }) end |