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:



537
538
539
540
541
542
543
544
545
# File 'lib/buildr/core/test.rb', line 537

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:



547
548
549
550
551
552
553
554
# File 'lib/buildr/core/test.rb', line 547

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.



561
562
563
# File 'lib/buildr/core/test.rb', line 561

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.



570
571
572
# File 'lib/buildr/core/test.rb', line 570

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