Permalink
Browse files

Bumped version number to 3.3.0.

  • Loading branch information...
1 parent e7fabc8 commit 837deeaa462dc0e20639813a4df410b1bb5d9d76 Mattias Petter Johansson committed Mar 10, 2013
Showing with 17 additions and 18 deletions.
  1. +16 −17 lib/beautiful-lies.js
  2. +1 −1 package.json
View
@@ -1,5 +1,5 @@
// Beautiful Lies
-// version: 3.2.1
+// version: 3.3.0
// author: Mattias Petter Johansson <mpj@mpj.me> http://mpj.me
// license: MIT
(function() {
@@ -73,19 +73,14 @@
assignHandler = function(host, function_name) {
var handler;
handler = function() {
- var expectation, expectations_matching, expectations_matching_args, handler_callback, m, match, message, process_result_spec, process_single_callback_spec, s, _i, _j, _len, _len1, _ref, _ref1, _ref2;
- expectation = null;
- expectations_matching = filter_on_function(host.__expectations, function_name);
- if (expectations_matching.length === 1 && !(expectations_matching[0]["arguments"] != null)) {
- expectation = expectations_matching[0];
- } else {
- expectations_matching_args = filter_on_args(expectations_matching, arguments);
- expectation = expectations_matching_args[0];
- }
+ var expectation, handler_callback, m, match, matches_args, matches_name, message, process_result_spec, process_single_callback_spec, s, _i, _j, _len, _len1, _ref, _ref1, _ref2;
+ matches_name = filter_on_function(host.__expectations, function_name);
+ matches_args = filter_on_args(matches_name, arguments);
+ expectation = matches_args[0];
if (!expectation) {
message = ("" + function_name + " called with unexpected arguments. ") + "Actual: " + args_as_array(arguments).join(', ');
- for (_i = 0, _len = expectations_matching.length; _i < _len; _i++) {
- match = expectations_matching[_i];
+ for (_i = 0, _len = matches_name.length; _i < _len; _i++) {
+ match = matches_name[_i];
message += "Possible: " + args_as_array(match["arguments"]).join(', ');
}
throw new Error(message);
@@ -261,12 +256,16 @@
return _results;
};
matches_args_obj = function(exp) {
- var exp_args, _ref;
- exp_args = (_ref = exp["arguments"]) != null ? _ref : [];
- if (!Array.isArray(exp_args)) {
- throw new Error("arguments must be of type Array.");
+ if (exp.check) {
+ return exp.check.apply(null, actual_args_cleaned);
+ } else if (exp["arguments"] != null) {
+ if (!Array.isArray(exp["arguments"])) {
+ throw new Error("arguments must be of type Array.");
+ }
+ return arrays_equal(exp["arguments"], actual_args_cleaned);
+ } else {
+ return true;
}
- return arrays_equal(exp_args, actual_args_cleaned);
};
actual_args_cleaned = remove_functions(args_obj);
return result();
View
@@ -1,6 +1,6 @@
{
"name": "beautiful-lies",
- "version": "3.2.1",
+ "version": "3.3.0",
"url": "https://github.com/mpj/beautiful-lies",
"author": {
"name": "Mattias Petter Johansson",

0 comments on commit 837deea

Please sign in to comment.