123456789_123456789_123456789_123456789_123456789_

Module: TestPuma::Assertions

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: test/helpers/test_puma/assertions.rb

Instance Method Summary

Instance Method Details

#assert_end_with(obj, str, msg = nil)

[ GitHub ]

  
# File 'test/helpers/test_puma/assertions.rb', line 13

def assert_end_with(obj, str, msg = nil)
  msg = message(msg) {
    "Expected\n#{obj}\nto end with #{str}"
  }
  assert_respond_to obj, :end_with?
  assert obj.end_with?(str), msg
end

#assert_match(matcher, obj, msg = nil)

if obj is longer than 80 characters, show as string, not inspected

[ GitHub ]

  
# File 'test/helpers/test_puma/assertions.rb', line 22

def assert_match(matcher, obj, msg = nil)
  msg = if obj.length < 80
    message(msg) { "Expected #{mu_pp matcher} to match #{mu_pp obj}" }
  else
    message(msg) { "Expected #{mu_pp matcher} to match:\n#{obj}\n" }
  end
  assert_respond_to matcher, :"=~"
  matcher = Regexp.new Regexp.escape matcher if String === matcher
  assert matcher =~ obj, msg
end

#assert_start_with(obj, str, msg = nil)

[ GitHub ]

  
# File 'test/helpers/test_puma/assertions.rb', line 5

def assert_start_with(obj, str, msg = nil)
  msg = message(msg) {
    "Expected\n#{obj}\nto start with #{str}"
  }
  assert_respond_to obj, :start_with?
  assert obj.start_with?(str), msg
end