Module: Rcodetools::XMPTestUnitFilter::Poetry

Defined in:
lib/rcodetools/xmptestunitfilter.rb

Instance Method Summary collapse

Instance Method Details

#equal_assertion(expected, actual) ⇒ Object



116
117
118
# File 'lib/rcodetools/xmptestunitfilter.rb', line 116

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

#nil_assertion(expression) ⇒ Object



96
97
98
# File 'lib/rcodetools/xmptestunitfilter.rb', line 96

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

#object_assertions(klass_txt, value_txt, expression) ⇒ Object



111
112
113
114
# File 'lib/rcodetools/xmptestunitfilter.rb', line 111

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



100
101
102
103
104
105
106
107
108
109
# File 'lib/rcodetools/xmptestunitfilter.rb', line 100

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