           [match, "to include #{Spec.Display expected}, actual #{Spec.Display value}, missing #{Spec.Display missing}"]
       else
         include([expected])
+    
+    window.haveHtml = (expected) ->
+      (value) ->
+        div = $(document.createElement 'div')
+        div.html expected
+        normalized = div.html()
+        actual = value.html()
+        [actual == normalized, "to have html #{Spec.Display normalized}, actual #{Spec.Display actual}"]
+  
+  extend: (klass) ->
+    @_extended.push klass
+    
+    @extendObject klass
+    @extendObject klass.prototype if klass.prototype
+  
+  extendObject: (extend) ->
+    
+    # Tests for a positive match
+    extend.should = (matcher) ->
+      if typeof matcher is 'function'
+        result = matcher(this)
+        Spec.fail "expected #{result[1]}" unless result[0]
+
+    # Tests for a negative match
+    extend.shouldNot = (matcher) ->
+      if typeof matcher is 'function'
+        result = matcher(this)
+        Spec.fail "expected not #{result[1]}" if result[0]
+
+    # Creates a stub method with an expectation
+    extend.shouldReceive = (name) ->
+      object = this
+
+      received = expectation "to receive &ldquo;#{name}&rdquo;"
+
+      passthrough = object[name]
+      object[name] = -> received.meet()
+
+      received.with = (expectArgs...) ->
+        object[name] = (args...) ->
+          received.meet()
+          correct = true
+          correct = false if expectArgs.length != args.length
+          if correct
+            for i in [0..args.length]
+              correct = false unless String(expectArgs[i]) == String(args[i])
+          unless correct
+            Spec.fail "expected ##{name} to be called with arguments &ldquo;#{expectArgs.join ', '}&rdquo;, actual arguments: &ldquo;#{args.join ', '}&rdquo;"
+        received
+
+      received.andReturn = (returnValue) ->
+        fn = object[name]
+        object[name] = ->
+          fn.apply this, arguments
+          returnValue
+        received
+
+      received.andPassthrough = ->
+        fn = object[name]
+        object[name] = ->
+          fn.apply this, arguments
+          passthrough.apply this, arguments
+        received
+
+      received
+
+    # Creates a stub method, with an expectation of no calls
+    extend.shouldNotReceive = (name) ->
+      @shouldReceive(name).exactly(0).times    
   
   # Fails test, with an error message
   fail: (message, location) ->

# Seaweed Coffeescript spec framework
window.Spec = {
  EnvironmentInitialized: false
  
  # Adds &nbsp; indentation to a string
  Pad: (string, times) ->

      when 'terminal'
        $('body').append('<div class="results"></div>')
    
    @extend Array
    @extend Boolean
    @extend Date
    @extend Function
    @extend Number
    @extend RegExp
    @extend String
    @extend Element
    @extend jQuery
    
    window.SpecObject = (object) ->
      $.extend this, object if object
      this
    @extend SpecObject
        
    # Sets up an expectation
    window.expectation = (message) ->
      exp = {
