Class: InspectWithTestCase

Inherits:
Test::Unit::TestCase show all
Defined in:
lib/quality_extensions/inspect_with.rb

Instance Method Summary collapse

Methods inherited from Test::Unit::TestCase

#assert_changed, #assert_exception, #assert_includes, #assert_user_error, #method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Test::Unit::TestCase

Instance Method Details

#setupObject



98
99
100
101
102
103
# File 'lib/quality_extensions/inspect_with.rb', line 98

def setup
  @div = HtmlElement.new(:div,
    HtmlElement.new(:ul,
      HtmlElement.new(:li, 'Hello'),
      HtmlElement.new(:li, 'World')))
end

#test_sanityObject



105
106
107
108
109
110
111
112
# File 'lib/quality_extensions/inspect_with.rb', line 105

def test_sanity
  string = @div.inspect

  assert_match /\#<HtmlElement:/, string
  assert_match /@name=:div/, string
  assert_no_match /@children/, string
  assert_equal @div.object_id * 2, string[/(0x.+?) /, 1].hex
end