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:



577
578
579
580
581
582
583
584
585
# File 'lib/buildr/core/test.rb', line 577

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:



587
588
589
590
591
592
593
594
# File 'lib/buildr/core/test.rb', line 587

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.



601
602
603
# File 'lib/buildr/core/test.rb', line 601

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.



610
611
612
# File 'lib/buildr/core/test.rb', line 610

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