Module: Rcodetools::XMPTestUnitFilter::WithParentheses

Defined in:
lib/rcodetools/xmptestunitfilter.rb

Instance Method Summary collapse

Instance Method Details

#equal_assertion(expected, actual) ⇒ Object



90
91
92
# File 'lib/rcodetools/xmptestunitfilter.rb', line 90

def equal_assertion(expected, actual)
  "assert_equal(#{expected}, #{actual})"
end

#nil_assertion(expression) ⇒ Object



70
71
72
# File 'lib/rcodetools/xmptestunitfilter.rb', line 70

def nil_assertion(expression)
  ["assert_nil(#{expression})"]
end

#object_assertions(klass_txt, value_txt, expression) ⇒ Object



85
86
87
88
# File 'lib/rcodetools/xmptestunitfilter.rb', line 85

def object_assertions(klass_txt, value_txt, expression)
  [ "assert_kind_of(#{klass_txt}, #{expression})",
    "assert_equal(#{value_txt.inspect}, #{expression}.inspect)" ]
end

#value_assertions(klass_txt, value_txt, value, expression) ⇒ Object



74
75
76
77
78
79
80
81
82
83
# File 'lib/rcodetools/xmptestunitfilter.rb', line 74

def value_assertions(klass_txt, value_txt, value, expression)
  case value
  when Float
    ["assert_in_delta(#{value.inspect}, #{expression}, #{FLOAT_TOLERANCE})"]
  when Numeric, String, Hash, Array, Regexp, TrueClass, FalseClass, Symbol, NilClass
    ["assert_equal(#{value_txt}, #{expression})"]
  else
    object_assertions(klass_txt, value_txt, expression)
  end
end