module Autoproj::ArubaMinitest

Minitest-usable Aruba wrapper

Aruba 0.14 is incompatible with Minitest because of their definition of the run method This change hacks around the problem, by moving the Aruba API to a side stub object.

The run methods are renamed as they have been renamed in Aruba 1.0 alpha, run -> run_command and run_simple -> run_command_and_stop

Public Instance Methods

assert_command_finished_successfully(cmd) click to toggle source
# File lib/autoproj/aruba_minitest.rb, line 71
def assert_command_finished_successfully(cmd)
    refute cmd.timed_out?, "#{cmd} timed out on stop"
    assert_equal 0, cmd.exit_status, "#{cmd} finished with a non-zero exit status (#{cmd.exit_status})\n-- STDOUT\n#{cmd.stdout}\n-- STDERR\n#{cmd.stderr}"
end
assert_command_stops(cmd, fail_on_error: true) click to toggle source
# File lib/autoproj/aruba_minitest.rb, line 66
def assert_command_stops(cmd, fail_on_error: true)
    cmd.stop
    assert_command_finished_successfully(cmd) if fail_on_error
end
cd(*args) click to toggle source
# File lib/autoproj/aruba_minitest.rb, line 50
def cd(*args) # also defined by Rake
    @aruba_api.cd(*args)
end
chmod(*args) click to toggle source
# File lib/autoproj/aruba_minitest.rb, line 54
def chmod(*args) # also defined by Rake
    @aruba_api.chmod(*args)
end
generate_local_gemfile() click to toggle source
# File lib/autoproj/aruba_minitest.rb, line 28
        def generate_local_gemfile
            path = expand_path("Gemfile.local")
            File.open(path, "w") do |io|
                io.write <<~GEMFILE
                source "https://rubygems.org"
                gem "autoproj", path: "#{File.expand_path('../../', __dir__)}"
                GEMFILE
            end
            path
        end
method_missing(m, *args, &block) click to toggle source
Calls superclass method
# File lib/autoproj/aruba_minitest.rb, line 58
def method_missing(m, *args, &block)
    if @aruba_api.respond_to?(m)
        @aruba_api.send(m, *args, &block)
    else
        super
    end
end
run_command(*args, **kwargs) click to toggle source
# File lib/autoproj/aruba_minitest.rb, line 46
def run_command(*args, **kwargs)
    @aruba_api.run_command(*args, **kwargs)
end
run_command_and_stop(*args, fail_on_error: true, **kwargs) click to toggle source
# File lib/autoproj/aruba_minitest.rb, line 39
def run_command_and_stop(*args, fail_on_error: true, **kwargs)
    cmd = run_command(*args, **kwargs)
    cmd.stop
    assert_command_finished_successfully(cmd) if fail_on_error
    cmd
end
setup() click to toggle source
Calls superclass method
# File lib/autoproj/aruba_minitest.rb, line 17
def setup
    super
    @aruba_api = API.new
    @aruba_api.setup_aruba
end
teardown() click to toggle source
Calls superclass method
# File lib/autoproj/aruba_minitest.rb, line 23
def teardown
    stop_all_commands
    super
end