Class: Roby::Test::ExecutionExpectations::FailsToStart

Inherits:
Expectation show all
Defined in:
lib/roby/test/execution_expectations.rb

Instance Attribute Summary

Attributes inherited from Expectation

#backtrace

Instance Method Summary collapse

Constructor Details

#initialize(task, reason, backtrace) ⇒ FailsToStart



960
961
962
963
964
965
966
967
968
969
# File 'lib/roby/test/execution_expectations.rb', line 960

def initialize(task, reason, backtrace)
    super(backtrace)
    @task = task
    @reason = reason
    if @reason && @reason.respond_to?(:to_execution_exception_matcher)
        @reason = @reason.to_execution_exception_matcher
        @related_error_matcher = LocalizedError.match.with_original_exception(@reason).
            to_execution_exception_matcher
    end
end

Instance Method Details

#explain_unachievable(propagation_info) ⇒ Object



993
994
995
# File 'lib/roby/test/execution_expectations.rb', line 993

def explain_unachievable(propagation_info)
    "#{@task.failure_reason} does not match #{@reason}"
end

#relates_to_error?(exception) ⇒ Boolean



987
988
989
990
991
# File 'lib/roby/test/execution_expectations.rb', line 987

def relates_to_error?(exception)
    if @reason
        (@reason === exception) || (@related_error_matcher === exception)
    end
end

#return_objectObject



997
998
999
# File 'lib/roby/test/execution_expectations.rb', line 997

def return_object
    @task.failure_reason
end

#to_sObject



1001
1002
1003
# File 'lib/roby/test/execution_expectations.rb', line 1001

def to_s
    "#{@generator} should fail to start"
end

#unachievable?(propagation_info) ⇒ Boolean



981
982
983
984
985
# File 'lib/roby/test/execution_expectations.rb', line 981

def unachievable?(propagation_info)
    if @reason && @task.failed_to_start?
        !(@reason === @task.failure_reason)
    end
end

#update_match(propagation_info) ⇒ Object



971
972
973
974
975
976
977
978
979
# File 'lib/roby/test/execution_expectations.rb', line 971

def update_match(propagation_info)
    if !@task.failed_to_start?
        false
    elsif !@reason
        true
    else
        @reason === @task.failure_reason
    end
end