Module: Rcodetools::XMPRSpecFilter::NewAPI::Poetry

Defined in:
lib/rcodetools/xmptestunitfilter.rb

Instance Method Summary collapse

Instance Method Details

#equal_assertion(expected, actual) ⇒ Object



204
205
206
# File 'lib/rcodetools/xmptestunitfilter.rb', line 204

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

#nil_assertion(expression) ⇒ Object



184
185
186
# File 'lib/rcodetools/xmptestunitfilter.rb', line 184

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

#object_assertions(klass_txt, value_txt, expression) ⇒ Object



199
200
201
202
# File 'lib/rcodetools/xmptestunitfilter.rb', line 199

def object_assertions(klass_txt, value_txt, expression)
  [ "#{expression}.should be_a_kind_of(#{klass_txt})",
    "#{expression}.inspect.should == #{value_txt.inspect}" ]
end

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



188
189
190
191
192
193
194
195
196
197
# File 'lib/rcodetools/xmptestunitfilter.rb', line 188

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 == #{value_txt}"]
  else
    object_assertions klass_txt, value_txt, expression
  end
end