Module: Rcodetools::XMPRSpecFilter::NewAPI::WithParentheses
- Defined in:
- lib/rcodetools/xmptestunitfilter.rb
Instance Method Summary collapse
- #equal_assertion(expected, actual) ⇒ Object
- #nil_assertion(expression) ⇒ Object
- #object_assertions(klass_txt, value_txt, expression) ⇒ Object
- #value_assertions(klass_txt, value_txt, value, expression) ⇒ Object
Instance Method Details
#equal_assertion(expected, actual) ⇒ Object
178 179 180 |
# File 'lib/rcodetools/xmptestunitfilter.rb', line 178 def equal_assertion(expected, actual) "(#{actual}).should == (#{expected})" end |
#nil_assertion(expression) ⇒ Object
158 159 160 |
# File 'lib/rcodetools/xmptestunitfilter.rb', line 158 def nil_assertion(expression) ["(#{expression}).should be_nil"] end |
#object_assertions(klass_txt, value_txt, expression) ⇒ Object
173 174 175 176 |
# File 'lib/rcodetools/xmptestunitfilter.rb', line 173 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
162 163 164 165 166 167 168 169 170 171 |
# File 'lib/rcodetools/xmptestunitfilter.rb', line 162 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 |