rspec-mocks 2.14.5 → 2.14.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 0a57d504d5c028fb2a8a99979fe762432c66e2c5
4
- data.tar.gz: 3936343e8929abf162cdec91f649590b94ee640b
5
- SHA512:
6
- metadata.gz: ec22b359484944c334d959dfc969446635712db242ceed9048855038948bc3fb29e58f6fc02057f179ef81e14e8481c6b87ad3e9994641ee16acef2ee9c7c4a0
7
- data.tar.gz: 9563ceb3a3aef25c443406f11f489dc48d9ea2b37e8052698ac167d430b34456ad90b0557c937777e170823def793d481b87ce0a80da711e4c1c371d84d5c150
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZWYzOGM0ZDZlNWI1YjhiOGY5N2MxMGEzODNlNzA4NzJiYmRiOWIwMg==
5
+ data.tar.gz: !binary |-
6
+ MjhlMWMxOWI0MTMxYjQzYmExMWVmODkwMGNhYzczYmY1MWU1ZTliMw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ OGM2M2FjZWM0YzJkMjkwOWE5Nzk0NWY3YjNmNGJlN2QxZjBjNmI2ZTU5NTQy
10
+ ODA3N2EyODNmNGFiYjA3M2FiZDQ5NTc5NThmYzVlNGJhMTY3ZTg0MTQyNjBj
11
+ NDZjY2Q2Y2ZiZTA1NTBlMjBhYTQzMWU1MDgyNzU1OGNhYzZkOTE=
12
+ data.tar.gz: !binary |-
13
+ MmNjMDFlNDM0MTZhZGNiZjhjMmQ1NDk4OGQ3YzViOGExOTVlMzUzNzI1MTI0
14
+ NjlkMTdkZmQyNjE5ODljNTc5MWE4M2E3NzQzY2Y0ZWEzZDVkYTQzNmM3OGY3
15
+ Yjg4ODM5ZmI0NjYyYjEzZGMyZGZjNzA2ZDExOTM3ZDY1OWY2YmQ=
@@ -1,3 +1,11 @@
1
+ ### 2.14.6 development
2
+ [full changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.5...v2.14.6)
3
+
4
+ Bug Fixes:
5
+
6
+ * Ensure `any_instance` method stubs and expectations are torn down regardless of
7
+ expectation failures. (Sam Phippen)
8
+
1
9
  ### 2.14.5 / 2014-02-01
2
10
  [full changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.4...v2.14.5)
3
11
 
@@ -88,9 +88,6 @@ module RSpec
88
88
  if @expectation_set && !message_chains.all_expectations_fulfilled?
89
89
  raise RSpec::Mocks::MockExpectationError, "Exactly one instance should have received the following message(s) but didn't: #{message_chains.unfulfilled_expectations.sort.join(', ')}"
90
90
  end
91
- ensure
92
- stop_all_observation!
93
- ::RSpec::Mocks.space.remove_any_instance_recorder_for(@klass)
94
91
  end
95
92
 
96
93
  # @private
@@ -27,6 +27,11 @@ module RSpec
27
27
  end
28
28
 
29
29
  proxies.clear
30
+
31
+ any_instance_recorders.each_value do |recorder|
32
+ recorder.stop_all_observation!
33
+ end
34
+
30
35
  any_instance_recorders.clear
31
36
  expectation_ordering.clear
32
37
  end
@@ -42,10 +47,6 @@ module RSpec
42
47
  end
43
48
  end
44
49
 
45
- def remove_any_instance_recorder_for(klass)
46
- any_instance_recorders.delete(klass.__id__)
47
- end
48
-
49
50
  def proxies_of(klass)
50
51
  proxies.values.select { |proxy| klass === proxy.object }
51
52
  end
@@ -1,7 +1,7 @@
1
1
  module RSpec
2
2
  module Mocks
3
3
  module Version
4
- STRING = '2.14.5'
4
+ STRING = '2.14.6'
5
5
  end
6
6
  end
7
7
  end
@@ -369,6 +369,7 @@ module RSpec
369
369
  klass.any_instance.should_not_receive(:bar)
370
370
  klass.new.foo
371
371
  RSpec::Mocks.space.verify_all
372
+ RSpec::Mocks.space.reset_all
372
373
  end
373
374
  end
374
375
 
@@ -391,24 +392,36 @@ module RSpec
391
392
 
392
393
  it "fails if an instance is created but no invocation occurs" do
393
394
  expect do
394
- klass.any_instance.should_receive(:foo)
395
- klass.new
396
- RSpec::Mocks.space.verify_all
395
+ begin
396
+ klass.any_instance.should_receive(:foo)
397
+ klass.new
398
+ RSpec::Mocks.space.verify_all
399
+ ensure
400
+ RSpec::Mocks.space.reset_all
401
+ end
397
402
  end.to raise_error(RSpec::Mocks::MockExpectationError, foo_expectation_error_message)
398
403
  end
399
404
 
400
405
  it "fails if no instance is created" do
401
406
  expect do
402
- klass.any_instance.should_receive(:foo).and_return(1)
403
- RSpec::Mocks.space.verify_all
407
+ begin
408
+ klass.any_instance.should_receive(:foo).and_return(1)
409
+ RSpec::Mocks.space.verify_all
410
+ ensure
411
+ RSpec::Mocks.space.reset_all
412
+ end
404
413
  end.to raise_error(RSpec::Mocks::MockExpectationError, foo_expectation_error_message)
405
414
  end
406
415
 
407
416
  it "fails if no instance is created and there are multiple expectations" do
408
417
  expect do
409
- klass.any_instance.should_receive(:foo)
410
- klass.any_instance.should_receive(:bar)
411
- RSpec::Mocks.space.verify_all
418
+ begin
419
+ klass.any_instance.should_receive(:foo)
420
+ klass.any_instance.should_receive(:bar)
421
+ RSpec::Mocks.space.verify_all
422
+ ensure
423
+ RSpec::Mocks.space.reset_all
424
+ end
412
425
  end.to raise_error(RSpec::Mocks::MockExpectationError, 'Exactly one instance should have received the following message(s) but didn\'t: bar, foo')
413
426
  end
414
427
 
@@ -470,24 +483,36 @@ module RSpec
470
483
 
471
484
  it "fails if an instance is created but no invocation occurs" do
472
485
  expect do
473
- klass.any_instance.should_receive(:existing_method)
474
- klass.new
475
- RSpec::Mocks.space.verify_all
486
+ begin
487
+ klass.any_instance.should_receive(:existing_method)
488
+ klass.new
489
+ RSpec::Mocks.space.verify_all
490
+ ensure
491
+ RSpec::Mocks.space.reset_all
492
+ end
476
493
  end.to raise_error(RSpec::Mocks::MockExpectationError, existing_method_expectation_error_message)
477
494
  end
478
495
 
479
496
  it "fails if no instance is created" do
480
497
  expect do
481
- klass.any_instance.should_receive(:existing_method)
482
- RSpec::Mocks.space.verify_all
498
+ begin
499
+ klass.any_instance.should_receive(:existing_method)
500
+ RSpec::Mocks.space.verify_all
501
+ ensure
502
+ RSpec::Mocks.space.reset_all
503
+ end
483
504
  end.to raise_error(RSpec::Mocks::MockExpectationError, existing_method_expectation_error_message)
484
505
  end
485
506
 
486
507
  it "fails if no instance is created and there are multiple expectations" do
487
508
  expect do
488
- klass.any_instance.should_receive(:existing_method)
489
- klass.any_instance.should_receive(:another_existing_method)
490
- RSpec::Mocks.space.verify_all
509
+ begin
510
+ klass.any_instance.should_receive(:existing_method)
511
+ klass.any_instance.should_receive(:another_existing_method)
512
+ RSpec::Mocks.space.verify_all
513
+ ensure
514
+ RSpec::Mocks.space.reset_all
515
+ end
491
516
  end.to raise_error(RSpec::Mocks::MockExpectationError, 'Exactly one instance should have received the following message(s) but didn\'t: another_existing_method, existing_method')
492
517
  end
493
518
 
@@ -580,16 +605,24 @@ module RSpec
580
605
 
581
606
  it "fails when no instances are declared" do
582
607
  expect do
583
- klass.any_instance.should_receive(:foo).once
584
- RSpec::Mocks.space.verify_all
608
+ begin
609
+ klass.any_instance.should_receive(:foo).once
610
+ RSpec::Mocks.space.verify_all
611
+ ensure
612
+ RSpec::Mocks.space.reset_all
613
+ end
585
614
  end.to raise_error(RSpec::Mocks::MockExpectationError, foo_expectation_error_message)
586
615
  end
587
616
 
588
617
  it "fails when an instance is declared but there are no invocations" do
589
618
  expect do
590
- klass.any_instance.should_receive(:foo).once
591
- klass.new
592
- RSpec::Mocks.space.verify_all
619
+ begin
620
+ klass.any_instance.should_receive(:foo).once
621
+ klass.new
622
+ RSpec::Mocks.space.verify_all
623
+ ensure
624
+ RSpec::Mocks.space.reset_all
625
+ end
593
626
  end.to raise_error(RSpec::Mocks::MockExpectationError, foo_expectation_error_message)
594
627
  end
595
628
 
@@ -714,9 +747,13 @@ module RSpec
714
747
 
715
748
  it "fails when the other expecations are not met" do
716
749
  expect do
717
- klass.any_instance.should_receive(:foo).never
718
- klass.any_instance.should_receive(:existing_method).and_return(5)
719
- RSpec::Mocks.space.verify_all
750
+ begin
751
+ klass.any_instance.should_receive(:foo).never
752
+ klass.any_instance.should_receive(:existing_method).and_return(5)
753
+ RSpec::Mocks.space.verify_all
754
+ ensure
755
+ RSpec::Mocks.space.reset_all
756
+ end
720
757
  end.to raise_error(RSpec::Mocks::MockExpectationError, existing_method_expectation_error_message)
721
758
  end
722
759
  end
@@ -752,9 +789,13 @@ module RSpec
752
789
 
753
790
  it "fails when the other expecations are not met" do
754
791
  expect do
755
- klass.any_instance.should_receive(:foo).any_number_of_times
756
- klass.any_instance.should_receive(:existing_method).and_return(5)
757
- RSpec::Mocks.space.verify_all
792
+ begin
793
+ klass.any_instance.should_receive(:foo).any_number_of_times
794
+ klass.any_instance.should_receive(:existing_method).and_return(5)
795
+ RSpec::Mocks.space.verify_all
796
+ ensure
797
+ RSpec::Mocks.space.reset_all
798
+ end
758
799
  end.to raise_error(RSpec::Mocks::MockExpectationError, existing_method_expectation_error_message)
759
800
  end
760
801
  end
@@ -779,6 +820,7 @@ module RSpec
779
820
 
780
821
  it "restores the class to its original state after each example when no instance is created" do
781
822
  space.verify_all
823
+ space.reset_all
782
824
 
783
825
  expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_false
784
826
  expect(klass.new.existing_method).to eq(existing_method_return_value)
@@ -788,6 +830,7 @@ module RSpec
788
830
  klass.new.existing_method
789
831
 
790
832
  space.verify_all
833
+ space.reset_all
791
834
 
792
835
  expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_false
793
836
  expect(klass.new.existing_method).to eq(existing_method_return_value)
@@ -798,6 +841,7 @@ module RSpec
798
841
  klass.new.existing_method
799
842
 
800
843
  space.verify_all
844
+ space.reset_all
801
845
 
802
846
  expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_false
803
847
  expect(klass.new.existing_method).to eq(existing_method_return_value)
@@ -808,6 +852,7 @@ module RSpec
808
852
  before :each do
809
853
  klass.any_instance.stub(:private_method).and_return(:something)
810
854
  space.verify_all
855
+ space.reset_all
811
856
  end
812
857
 
813
858
  it "cleans up the backed up method" do
@@ -830,6 +875,7 @@ module RSpec
830
875
  klass.any_instance.should_receive(:private_method).and_return(:something)
831
876
  klass.new.private_method
832
877
  space.verify_all
878
+ space.reset_all
833
879
  end
834
880
 
835
881
  it "cleans up the backed up method" do
@@ -877,6 +923,7 @@ module RSpec
877
923
  klass.any_instance.should_receive(:existing_method).and_return(Object.new)
878
924
  klass.new.existing_method
879
925
  space.verify_all
926
+ space.reset_all
880
927
 
881
928
  expect(klass.new.existing_method).to eq(existing_method_return_value)
882
929
  end
@@ -889,6 +936,7 @@ module RSpec
889
936
  klass.any_instance.stub(:existing_method).and_return(true)
890
937
 
891
938
  RSpec::Mocks.space.verify_all
939
+ RSpec::Mocks.space.reset_all
892
940
  expect(klass.new).to respond_to(:existing_method)
893
941
  expect(klass.new.existing_method).to eq(existing_method_return_value)
894
942
  end
@@ -978,6 +1026,7 @@ module RSpec
978
1026
  expect(instance.existing_method).to eq :stubbed_return_value
979
1027
 
980
1028
  RSpec::Mocks.verify
1029
+ RSpec::Mocks.teardown
981
1030
 
982
1031
  expect(instance.existing_method).to eq :existing_method_return_value
983
1032
  end
@@ -9,6 +9,10 @@ module RSpec
9
9
  ::RSpec::Mocks.space.verify_all
10
10
  end
11
11
 
12
+ def reset_all
13
+ ::RSpec::Mocks.space.reset_all
14
+ end
15
+
12
16
  shared_examples_for "a receive matcher" do |*options|
13
17
  it 'allows the caller to configure how the subject responds' do
14
18
  wrapped.to receive(:foo).and_return(5)
@@ -97,6 +101,8 @@ module RSpec
97
101
  expect {
98
102
  verify_all
99
103
  }.to raise_error(RSpec::Mocks::MockExpectationError)
104
+
105
+ reset_all
100
106
  end
101
107
 
102
108
  it "reports the line number of expectation of unreceived message", :pending => options.include?(:does_not_report_line_num) do
@@ -97,16 +97,6 @@ module RSpec
97
97
  expect(r1).to be(r2)
98
98
  expect(r1).not_to be(r3)
99
99
  end
100
-
101
- it 'removes an any_instance_recorder when requested' do
102
- klass = Class.new
103
-
104
- space.any_instance_recorder_for(klass)
105
-
106
- expect {
107
- space.remove_any_instance_recorder_for(klass)
108
- }.to change { space.any_instance_recorders.size }.by(-1)
109
- end
110
100
  end
111
101
  end
112
102
  end
metadata CHANGED
@@ -1,56 +1,64 @@
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.5
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.14.6
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
- 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:
12
+ date: 2014-02-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !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
- prerelease: false
22
- name: rake
23
21
  type: :development
24
- requirement: *id001
25
- - !ruby/object:Gem::Dependency
26
- version_requirements: &id002 !ruby/object:Gem::Requirement
27
- requirements:
28
- - - ~>
29
- - !ruby/object:Gem::Version
30
- version: 1.1.9
31
22
  prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: 10.0.0
28
+ - !ruby/object:Gem::Dependency
32
29
  name: cucumber
33
- type: :development
34
- requirement: *id002
35
- - !ruby/object:Gem::Dependency
36
- version_requirements: &id003 !ruby/object:Gem::Requirement
37
- requirements:
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
38
32
  - - ~>
39
- - !ruby/object:Gem::Version
40
- version: "0.5"
33
+ - !ruby/object:Gem::Version
34
+ version: 1.1.9
35
+ type: :development
41
36
  prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: 1.1.9
42
+ - !ruby/object:Gem::Dependency
42
43
  name: aruba
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ version: '0.5'
43
49
  type: :development
44
- requirement: *id003
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: '0.5'
45
56
  description: RSpec's 'test double' framework, with support for stubbing and mocking
46
57
  email: rspec-users@rubyforge.org
47
58
  executables: []
48
-
49
59
  extensions: []
50
-
51
60
  extra_rdoc_files: []
52
-
53
- files:
61
+ files:
54
62
  - lib/rspec/mocks.rb
55
63
  - lib/rspec/mocks/any_instance/chain.rb
56
64
  - lib/rspec/mocks/any_instance/expectation_chain.rb
@@ -186,32 +194,31 @@ files:
186
194
  - spec/rspec/mocks_spec.rb
187
195
  - spec/spec_helper.rb
188
196
  homepage: http://github.com/rspec/rspec-mocks
189
- licenses:
197
+ licenses:
190
198
  - MIT
191
199
  metadata: {}
192
-
193
200
  post_install_message:
194
- rdoc_options:
201
+ rdoc_options:
195
202
  - --charset=UTF-8
196
- require_paths:
203
+ require_paths:
197
204
  - lib
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
205
+ required_ruby_version: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ! '>='
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ required_rubygems_version: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - ! '>='
213
+ - !ruby/object:Gem::Version
214
+ version: '0'
207
215
  requirements: []
208
-
209
216
  rubyforge_project: rspec
210
- rubygems_version: 2.0.3
217
+ rubygems_version: 2.0.7
211
218
  signing_key:
212
219
  specification_version: 4
213
- summary: rspec-mocks-2.14.5
214
- test_files:
220
+ summary: rspec-mocks-2.14.6
221
+ test_files:
215
222
  - features/README.md
216
223
  - features/Scope.md
217
224
  - features/Upgrade.md