Commits

Dan Dirks committed 4e72b78

Fixes a few small errors in acceptance.

The if around the throw is unneeded, as we return for every valid value
before hitting the throw. Also, adds a message to assertion failures for
verifying text in field.

  • Participants
  • Parent commits 58a221a

Comments (0)

Files changed (2)

File lib/acceptance.js

         return page.replace(sitePageRegex, sitePath);
       }
     }
-    if (!this.pages[page]) {
-      throw new Error("Page '" + page + "' not defined");
-    }
+    throw new Error("Page '" + page + "' not defined");
   };
 
   function Acceptance(callback) {
   Acceptance.prototype.verifyTextInField = function(text, field, callback) {
     var element;
     element = this.World.findElement("input[name='" + field + "'], textarea[name='" + field + "']");
-    assert.equal(element.value, text);
+    assert.equal(element.value, text, "Text '" + text + "' not found in field '" + field + "'");
     return callback();
   };
 

File src/acceptance.coffee

       sitePageRegex = new RegExp("^#{sitePage}$")
       return page.replace(sitePageRegex, sitePath) if page.match(sitePageRegex)
 
-    throw new Error("Page '#{page}' not defined") if not @pages[page]
+    throw new Error("Page '#{page}' not defined")
 
   ##
   # Creates a new acceptance object.
   #
   verifyTextInField: (text, field, callback) ->
     element = @World.findElement("input[name='#{field}'], textarea[name='#{field}']")
-    assert.equal(element.value, text)
+    assert.equal(element.value, text, "Text '#{text}' not found in field '#{field}'")
     callback()
 
   ##