lib/fun_with/testing/assertions/basics.rb
# `expected` can be a numeric range 
`expected` can be a numeric range
` expected ` can be a numeric range
def assert_length( expected, actual, msg = nil )
          no_response_msg = message(nil){ "<#{mu_pp(actual)}> doesn't respond to .length()" }
          assert_respond_to actual, :length, no_response_msg
          case expected
          when Range
            msg = message(msg){ 
              "<#{mu_pp(actual)}> has a length of #{mu_pp(actual.length)}. Length must be between <#{mu_pp(expected.min)}> and <#{mu_pp(expected.max)}>"
            }
            assert_at_least expected.min, actual.length, msg
            assert_at_most  expected.max, actual.length, msg
          when Integer
            msg = message(msg){ "<#{mu_pp(actual)}> has a length of <#{mu_pp(actual.length)}>. Expected length was <#{mu_pp(expected)}>" }
            assert_equal( expected, actual.length, msg )
          else
            flunk( "Bad reference value (first argument: #{expected.inspect}) to assert_length" )
          end
        end
def assert_length ( expected , actual , msg = nil ) no_response_msg = message ( nil ) { "<#{mu_pp(actual)}> doesn't respond to .length()" } assert_respond_to actual , :length , no_response_msg case expected when Range msg = message ( msg ) { "<#{mu_pp(actual)}> has a length of #{mu_pp(actual.length)}. Length must be between <#{mu_pp(expected.min)}> and <#{mu_pp(expected.max)}>" } assert_at_least expected . min , actual . length , msg assert_at_most expected . max , actual . length , msg when Integer msg = message ( msg ) { "<#{mu_pp(actual)}> has a length of <#{mu_pp(actual.length)}>. Expected length was <#{mu_pp(expected)}>" } assert_equal ( expected , actual . length , msg ) else flunk ( "Bad reference value (first argument: #{expected.inspect}) to assert_length" ) end end
`expected` can be a numeric range
` expected ` can be a numeric range
expected
<not_specific>
actual
<not_specific>
msg
<not_specific>