konacha-chai-matchers 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  module Konacha
2
2
  module Chai
3
3
  module Matchers
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
6
6
  end
7
7
  end
@@ -22,7 +22,7 @@
22
22
  */
23
23
 
24
24
  chai.Assertion.addMethod('when', function(val, options) {
25
- var action, definedActions, done, _i, _j, _len, _len1, _results,
25
+ var action, definedActions, done, result, _i, _j, _len, _len1, _results,
26
26
  _this = this;
27
27
  if (options == null) {
28
28
  options = {};
@@ -34,12 +34,13 @@
34
34
  action.before(this);
35
35
  }
36
36
  }
37
- if (val.then != null) {
37
+ result = val();
38
+ if (result.then != null) {
38
39
  done = options != null ? options.notify : void 0;
39
40
  if (done == null) {
40
41
  done = function() {};
41
42
  }
42
- return val.then(function() {
43
+ return result.then(function() {
43
44
  var _j, _len1;
44
45
  try {
45
46
  for (_j = 0, _len1 = definedActions.length; _j < _len1; _j++) {
@@ -50,13 +51,10 @@
50
51
  }
51
52
  return done();
52
53
  } catch (error) {
53
- return done(error);
54
+ return done(new Error(error));
54
55
  }
55
56
  });
56
57
  } else {
57
- if (typeof val === "function") {
58
- val();
59
- }
60
58
  _results = [];
61
59
  for (_j = 0, _len1 = definedActions.length; _j < _len1; _j++) {
62
60
  action = definedActions[_j];
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: konacha-chai-matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -53,21 +53,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
53
  - - ! '>='
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
- segments:
57
- - 0
58
- hash: 500102349
59
56
  required_rubygems_version: !ruby/object:Gem::Requirement
60
57
  none: false
61
58
  requirements:
62
59
  - - ! '>='
63
60
  - !ruby/object:Gem::Version
64
61
  version: '0'
65
- segments:
66
- - 0
67
- hash: 500102349
68
62
  requirements: []
69
63
  rubyforge_project: konacha-chai-matchers
70
- rubygems_version: 1.8.15
64
+ rubygems_version: 1.8.23
71
65
  signing_key:
72
66
  specification_version: 3
73
67
  summary: Chai.js plugins collection for Konacha