sinon-chai-rails 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE.txt ADDED
@@ -0,0 +1,14 @@
1
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2
+ Version 2, December 2004
3
+
4
+ Copyright (C) 2012 Domenic Denicola <domenic@domenicdenicola.com>
5
+
6
+ Everyone is permitted to copy and distribute verbatim or modified
7
+ copies of this license document, and changing it is allowed as long
8
+ as the name is changed.
9
+
10
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12
+
13
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
14
+
data/README.md CHANGED
@@ -13,5 +13,12 @@ Rubygems
13
13
 
14
14
  The gem is hosted on rubygems.org at [sinon-chai-rails][rubygems-gem-url].
15
15
 
16
+ License
17
+ -------
18
+
19
+ As this is packaging for [Sinon-Chai][sinon-chai] it falls under the same license. See
20
+ [LICENSE.txt][license-txt] for details.
21
+
16
22
  [sinon-chai]: https://github.com/domenic/sinon-chai
17
23
  [rubygems-gem-url]: https://rubygems.org/gems/sinon-chai-rails
24
+ [license-txt]: https://github.com/cymen/sinon-chai-rails/blob/master/LICENSE.txt
@@ -1,7 +1,7 @@
1
1
  module Sinon
2
2
  module Chai
3
3
  module Rails
4
- VERSION = "1.0.3"
4
+ VERSION = "1.1.0"
5
5
  end
6
6
  end
7
7
  end
@@ -26,6 +26,13 @@
26
26
  typeof putativeSpy.calledWithExactly === "function";
27
27
  }
28
28
 
29
+ function timesInWords(count) {
30
+ return count === 1 ? "once" :
31
+ count === 2 ? "twice" :
32
+ count === 3 ? "thrice" :
33
+ (count || 0) + " times";
34
+ }
35
+
29
36
  function isCall(putativeCall) {
30
37
  return putativeCall && isSpy(putativeCall.proxy);
31
38
  }
@@ -62,6 +69,15 @@
62
69
  });
63
70
  }
64
71
 
72
+ function sinonPropertyAsBooleanMethod(name, action, nonNegatedSuffix) {
73
+ utils.addMethod(chai.Assertion.prototype, name, function (arg) {
74
+ assertCanWorkWith(this);
75
+
76
+ var messages = getMessages(this._obj, action, nonNegatedSuffix, false, [timesInWords(arg)]);
77
+ this.assert(this._obj[name] === arg, messages.affirmative, messages.negative);
78
+ });
79
+ }
80
+
65
81
  function createSinonMethodHandler(sinonName, action, nonNegatedSuffix) {
66
82
  return function () {
67
83
  assertCanWorkWith(this);
@@ -94,6 +110,7 @@
94
110
  });
95
111
 
96
112
  sinonProperty("called", "been called", " at least once, but it was never called");
113
+ sinonPropertyAsBooleanMethod("callCount", "been called exactly %1", ", but it was called %c%C");
97
114
  sinonProperty("calledOnce", "been called exactly once", ", but it was called %c%C");
98
115
  sinonProperty("calledTwice", "been called exactly twice", ", but it was called %c%C");
99
116
  sinonProperty("calledThrice", "been called exactly thrice", ", but it was called %c%C");
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.3
4
+ version: 1.1.0
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: 2013-01-10 00:00:00.000000000 Z
12
+ date: 2014-01-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -36,6 +36,7 @@ extra_rdoc_files: []
36
36
  files:
37
37
  - .gitignore
38
38
  - Gemfile
39
+ - LICENSE.txt
39
40
  - README.md
40
41
  - Rakefile
41
42
  - lib/sinon-chai-rails.rb
@@ -63,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
64
  version: '0'
64
65
  requirements: []
65
66
  rubyforge_project:
66
- rubygems_version: 1.8.22
67
+ rubygems_version: 1.8.25
67
68
  signing_key:
68
69
  specification_version: 3
69
70
  summary: sinon-chai.js via asset pipeline