rspec-mocks 2.14.4 → 2.14.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -15
- data/Changelog.md +10 -0
- data/lib/rspec/mocks/message_expectation.rb +21 -4
- data/lib/rspec/mocks/version.rb +1 -1
- data/spec/rspec/mocks/block_return_value_spec.rb +11 -0
- data/spec/rspec/mocks/stub_chain_spec.rb +12 -0
- metadata +49 -56
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
OGU0Y2Y4ZmQ1OTFiYzU4YjM2OTYxYTMzMmExYWUzZWE0NGNjYTFiODlmYjli
|
10
|
-
YzIxMzUxZTVkZDFjNmYzY2Q1ZDQ2MmM1NjEwYWQ0OGU2YzM4MjhhN2FkNWQ5
|
11
|
-
YTNjNWZiYTg1NDNhODYyZGMxZjJiOTVhNDc4MDFjNDBlYTY3ZGM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MDBmNWNkYzMxZTA1M2UwYjE2YmRlMGFiYTc4YTZmN2FhMDk4ZmU5YWY5NTU5
|
14
|
-
NzU3NjhmNjllMzU0ZTM4OWE2YmFjMThlNGYyMWFjZTI5NjQxNjQ0NzJlMzdh
|
15
|
-
OWFkZmE1MDg2NDk2MzdkYmY1MjMyZGFiZGRkNGFjN2VkNzMzNDU=
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0a57d504d5c028fb2a8a99979fe762432c66e2c5
|
4
|
+
data.tar.gz: 3936343e8929abf162cdec91f649590b94ee640b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ec22b359484944c334d959dfc969446635712db242ceed9048855038948bc3fb29e58f6fc02057f179ef81e14e8481c6b87ad3e9994641ee16acef2ee9c7c4a0
|
7
|
+
data.tar.gz: 9563ceb3a3aef25c443406f11f489dc48d9ea2b37e8052698ac167d430b34456ad90b0557c937777e170823def793d481b87ce0a80da711e4c1c371d84d5c150
|
data/Changelog.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
### 2.14.5 / 2014-02-01
|
2
|
+
[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.4...v2.14.5)
|
3
|
+
|
4
|
+
Bug Fixes:
|
5
|
+
|
6
|
+
* Fix regression that caused block implementations to not receive all
|
7
|
+
args on 1.8.7 if the block also receives a block, due to Proc#arity
|
8
|
+
reporting `1` no matter how many args the block receives if it
|
9
|
+
receives a block, too. (Myron Marston)
|
10
|
+
|
1
11
|
### 2.14.4 / 2013-10-15
|
2
12
|
[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.3...v2.14.4)
|
3
13
|
|
@@ -520,10 +520,27 @@ module RSpec
|
|
520
520
|
end.last
|
521
521
|
end
|
522
522
|
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
523
|
+
if RUBY_VERSION.to_f > 1.8
|
524
|
+
def arg_slice_for(args, arity)
|
525
|
+
if arity >= 0
|
526
|
+
args.slice(0, arity)
|
527
|
+
else
|
528
|
+
args
|
529
|
+
end
|
530
|
+
end
|
531
|
+
else
|
532
|
+
# 1.8.7's `arity` lies somtimes:
|
533
|
+
# Given:
|
534
|
+
# def print_arity(&b) puts b.arity; end
|
535
|
+
#
|
536
|
+
# This prints 1:
|
537
|
+
# print_arity { |a, b, c, &bl| }
|
538
|
+
#
|
539
|
+
# But this prints 3:
|
540
|
+
# print_arity { |a, b, c| }
|
541
|
+
#
|
542
|
+
# Given that it lies, we can't trust it and we don't slice the args.
|
543
|
+
def arg_slice_for(args, arity)
|
527
544
|
args
|
528
545
|
end
|
529
546
|
end
|
data/lib/rspec/mocks/version.rb
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe "a double declaration with a block handed to:" do
|
4
|
+
# The "receives a block" part is important: 1.8.7 has a bug that reports the
|
5
|
+
# wrong arity when a block receives a block.
|
6
|
+
it 'forwards all given args to the block, even when it receives a block', :unless => RUBY_VERSION.to_s == '1.8.6' do
|
7
|
+
obj = Object.new
|
8
|
+
yielded_args = []
|
9
|
+
eval("obj.stub(:foo) { |*args, &bl| yielded_args << args }")
|
10
|
+
obj.foo(1, 2, 3)
|
11
|
+
|
12
|
+
expect(yielded_args).to eq([[1, 2, 3]])
|
13
|
+
end
|
14
|
+
|
4
15
|
describe "should_receive" do
|
5
16
|
it "returns the value of executing the block" do
|
6
17
|
obj = Object.new
|
@@ -29,6 +29,18 @@ module RSpec
|
|
29
29
|
end
|
30
30
|
|
31
31
|
context "with two methods in chain" do
|
32
|
+
it "accepts any number of arguments to the stubbed messages" do
|
33
|
+
object.stub_chain(:msg1, :msg2).and_return(:return_value)
|
34
|
+
|
35
|
+
expect(object.msg1("nonsense", :value).msg2("another", :nonsense, 3.0, "value")).to eq(:return_value)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "accepts any number of arguments to the stubbed messages with a return value from a hash" do
|
39
|
+
object.stub_chain(:msg1, :msg2 => :return_value)
|
40
|
+
|
41
|
+
expect(object.msg1("nonsense", :value).msg2("another", :nonsense, 3.0, "value")).to eq(:return_value)
|
42
|
+
end
|
43
|
+
|
32
44
|
context "using and_return" do
|
33
45
|
it "returns expected value from chaining two method calls" do
|
34
46
|
object.stub_chain(:msg1, :msg2).and_return(:return_value)
|
metadata
CHANGED
@@ -1,64 +1,56 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-mocks
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.14.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.14.5
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Steven Baker
|
8
8
|
- David Chelimsky
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
requirements:
|
12
|
+
|
13
|
+
date: 2014-02-01 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
18
|
- - ~>
|
19
|
-
- !ruby/object:Gem::Version
|
19
|
+
- !ruby/object:Gem::Version
|
20
20
|
version: 10.0.0
|
21
|
-
type: :development
|
22
21
|
prerelease: false
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
name: cucumber
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
22
|
+
name: rake
|
23
|
+
type: :development
|
24
|
+
requirement: *id001
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
32
28
|
- - ~>
|
33
|
-
- !ruby/object:Gem::Version
|
29
|
+
- !ruby/object:Gem::Version
|
34
30
|
version: 1.1.9
|
35
|
-
type: :development
|
36
31
|
prerelease: false
|
37
|
-
|
38
|
-
|
32
|
+
name: cucumber
|
33
|
+
type: :development
|
34
|
+
requirement: *id002
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
39
38
|
- - ~>
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version:
|
42
|
-
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: "0.5"
|
41
|
+
prerelease: false
|
43
42
|
name: aruba
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ~>
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0.5'
|
49
43
|
type: :development
|
50
|
-
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ~>
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0.5'
|
44
|
+
requirement: *id003
|
56
45
|
description: RSpec's 'test double' framework, with support for stubbing and mocking
|
57
46
|
email: rspec-users@rubyforge.org
|
58
47
|
executables: []
|
48
|
+
|
59
49
|
extensions: []
|
50
|
+
|
60
51
|
extra_rdoc_files: []
|
61
|
-
|
52
|
+
|
53
|
+
files:
|
62
54
|
- lib/rspec/mocks.rb
|
63
55
|
- lib/rspec/mocks/any_instance/chain.rb
|
64
56
|
- lib/rspec/mocks/any_instance/expectation_chain.rb
|
@@ -194,31 +186,32 @@ files:
|
|
194
186
|
- spec/rspec/mocks_spec.rb
|
195
187
|
- spec/spec_helper.rb
|
196
188
|
homepage: http://github.com/rspec/rspec-mocks
|
197
|
-
licenses:
|
189
|
+
licenses:
|
198
190
|
- MIT
|
199
191
|
metadata: {}
|
192
|
+
|
200
193
|
post_install_message:
|
201
|
-
rdoc_options:
|
194
|
+
rdoc_options:
|
202
195
|
- --charset=UTF-8
|
203
|
-
require_paths:
|
196
|
+
require_paths:
|
204
197
|
- lib
|
205
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
206
|
-
requirements:
|
207
|
-
-
|
208
|
-
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
version: '0'
|
198
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
199
|
+
requirements:
|
200
|
+
- &id004
|
201
|
+
- ">="
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: "0"
|
204
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- *id004
|
215
207
|
requirements: []
|
208
|
+
|
216
209
|
rubyforge_project: rspec
|
217
|
-
rubygems_version: 2.0.
|
210
|
+
rubygems_version: 2.0.3
|
218
211
|
signing_key:
|
219
212
|
specification_version: 4
|
220
|
-
summary: rspec-mocks-2.14.
|
221
|
-
test_files:
|
213
|
+
summary: rspec-mocks-2.14.5
|
214
|
+
test_files:
|
222
215
|
- features/README.md
|
223
216
|
- features/Scope.md
|
224
217
|
- features/Upgrade.md
|