sinon-chai-rails 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,6 +1,17 @@
1
1
  Sinon.JS Assertions for Chai with Rails
2
2
  =======================================
3
3
 
4
- This is a gem for [sinon-chai][sinon-chai] in order to use it with the Rails asset pipeline.
4
+ This is a gem for [Sinon-Chai][sinon-chai] in order to use it with the Rails asset pipeline.
5
+
6
+ Installing
7
+ ----------
8
+
9
+ gem install sinon-chai-rails
10
+
11
+ Rubygems
12
+ --------
13
+
14
+ The gem is hosted on rubygems.org at [sinon-chai-rails][rubygems-gem-url].
5
15
 
6
16
  [sinon-chai]: https://github.com/domenic/sinon-chai
17
+ [rubygems-gem-url]: https://rubygems.org/gems/sinon-chai-rails
@@ -1,7 +1,7 @@
1
1
  module Sinon
2
2
  module Chai
3
3
  module Rails
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.2"
5
5
  end
6
6
  end
7
7
  end
@@ -60,8 +60,8 @@
60
60
  });
61
61
  }
62
62
 
63
- function exceptionalSinonMethod(chaiName, sinonName, action, nonNegatedSuffix) {
64
- utils.addMethod(chai.Assertion.prototype, chaiName, function () {
63
+ function createSinonMethodHandler(sinonName, action, nonNegatedSuffix) {
64
+ return function () {
65
65
  assertCanWorkWith(this);
66
66
 
67
67
  var alwaysSinonMethod = "always" + sinonName[0].toUpperCase() + sinonName.substring(1);
@@ -70,7 +70,17 @@
70
70
 
71
71
  var messages = getMessages(this._obj, action, nonNegatedSuffix, shouldBeAlways, slice.call(arguments));
72
72
  this.assert(this._obj[sinonMethod].apply(this._obj, arguments), messages.affirmative, messages.negative);
73
- });
73
+ };
74
+ }
75
+
76
+ function sinonMethodAsProperty(name, action, nonNegatedSuffix) {
77
+ var handler = createSinonMethodHandler(name, action, nonNegatedSuffix);
78
+ utils.addProperty(chai.Assertion.prototype, name, handler);
79
+ }
80
+
81
+ function exceptionalSinonMethod(chaiName, sinonName, action, nonNegatedSuffix) {
82
+ var handler = createSinonMethodHandler(sinonName, action, nonNegatedSuffix);
83
+ utils.addMethod(chai.Assertion.prototype, chaiName, handler);
74
84
  }
75
85
 
76
86
  function sinonMethod(name, action, nonNegatedSuffix) {
@@ -85,6 +95,7 @@
85
95
  sinonProperty("calledOnce", "been called exactly once", ", but it was called %c%C");
86
96
  sinonProperty("calledTwice", "been called exactly twice", ", but it was called %c%C");
87
97
  sinonProperty("calledThrice", "been called exactly thrice", ", but it was called %c%C");
98
+ sinonMethodAsProperty("calledWithNew", "been called with new");
88
99
  sinonMethod("calledBefore", "been called before %1");
89
100
  sinonMethod("calledAfter", "been called after %1");
90
101
  sinonMethod("calledOn", "been called with %1 as this", ", but it was called with %t instead");
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinon-chai-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-11 00:00:00.000000000 Z
12
+ date: 2012-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -57,7 +57,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
57
57
  version: '0'
58
58
  segments:
59
59
  - 0
60
- hash: 232721519219228683
60
+ hash: 118299963058937580
61
61
  required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  version: '0'
67
67
  segments:
68
68
  - 0
69
- hash: 232721519219228683
69
+ hash: 118299963058937580
70
70
  requirements: []
71
71
  rubyforge_project:
72
72
  rubygems_version: 1.8.24