Module: Rcodetools::XMPRSpecFilter::OldAPI::Poetry

Defined in:
lib/rcodetools/xmptestunitfilter.rb

Instance Method Summary collapse

Instance Method Details

#equal_assertion(expected, actual) ⇒ Object



263
264
265
# File 'lib/rcodetools/xmptestunitfilter.rb', line 263

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

#nil_assertion(expression) ⇒ Object



243
244
245
# File 'lib/rcodetools/xmptestunitfilter.rb', line 243

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

#object_assertions(klass_txt, value_txt, expression) ⇒ Object



258
259
260
261
# File 'lib/rcodetools/xmptestunitfilter.rb', line 258

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

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



247
248
249
250
251
252
253
254
255
256
# File 'lib/rcodetools/xmptestunitfilter.rb', line 247

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