Class: Buildr::IntegrationTestsTask

Inherits:
Rake::Task show all
Defined in:
lib/buildr/core/test.rb

Overview

The integration tests task. Buildr has one such task (see Buildr#integration) that runs all tests marked with :integration=>true, and has a setup/teardown tasks separate from the unit tests.

Instance Method Summary collapse

Methods inherited from Rake::Task

#invoke, #invoke_with_call_chain

Constructor Details

#initialize(*args) ⇒ IntegrationTestsTask

:nodoc:



489
490
491
492
493
494
495
496
497
# File 'lib/buildr/core/test.rb', line 489

def initialize(*args) #:nodoc:
  super
  @setup = task("#{name}:setup")
  @teardown = task("#{name}:teardown")
  enhance do
    info 'Running integration tests...'
    TestTask.run_local_tests true
  end
end

Instance Method Details

#execute(args) ⇒ Object

:nodoc:



499
500
501
502
503
504
505
506
# File 'lib/buildr/core/test.rb', line 499

def execute(args) #:nodoc:
  setup.invoke
  begin
    super
  ensure
    teardown.invoke
  end
end

#setup(*prereqs, &block) ⇒ Object

:call-seq:

setup(*prereqs) => task
setup(*prereqs) { |task| .. } => task

Returns the setup task. The setup task is executed before running the integration tests.



513
514
515
# File 'lib/buildr/core/test.rb', line 513

def setup(*prereqs, &block)
  @setup.enhance prereqs, &block
end

#teardown(*prereqs, &block) ⇒ Object

:call-seq:

teardown(*prereqs) => task
teardown(*prereqs) { |task| .. } => task

Returns the teardown task. The teardown task is executed after running the integration tests.



522
523
524
# File 'lib/buildr/core/test.rb', line 522

def teardown(*prereqs, &block)
  @teardown.enhance prereqs, &block
end