rspec-mocks 2.5.0 → 2.6.0
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/.travis.yml +7 -0
- data/Gemfile +14 -13
- data/Guardfile +3 -3
- data/README.md +2 -0
- data/features/.nav +4 -0
- data/features/Changelog.md +12 -0
- data/features/README.markdown +44 -4
- data/features/Upgrade.md +10 -2
- data/features/message_expectations/any_instance.feature +19 -0
- data/features/message_expectations/block_local_expectations.feature.pending +2 -2
- data/features/message_expectations/expect_message.feature +3 -3
- data/features/message_expectations/warn_when_expectation_is_set_on_nil.feature +3 -3
- data/features/method_stubs/README.md +32 -24
- data/features/method_stubs/any_instance.feature +23 -0
- data/features/method_stubs/as_null_object.feature +36 -0
- data/features/method_stubs/simple_return_value.feature +2 -2
- data/features/method_stubs/stub_chain.feature +13 -6
- data/features/method_stubs/stub_implementation.feature +1 -1
- data/features/method_stubs/to_ary.feature +45 -0
- data/features/outside_rspec/configuration.feature +3 -3
- data/features/outside_rspec/standalone.feature +2 -2
- data/features/step_definitions/additional_cli_steps.rb +4 -0
- data/features/support/env.rb +5 -1
- data/lib/rspec/mocks/any_instance.rb +256 -0
- data/lib/rspec/mocks/argument_expectation.rb +9 -8
- data/lib/rspec/mocks/extensions/marshal.rb +0 -4
- data/lib/rspec/mocks/extensions/psych.rb +23 -0
- data/lib/rspec/mocks/framework.rb +1 -0
- data/lib/rspec/mocks/message_expectation.rb +7 -4
- data/lib/rspec/mocks/methods.rb +1 -1
- data/lib/rspec/mocks/mock.rb +2 -2
- data/lib/rspec/mocks/serialization.rb +5 -3
- data/lib/rspec/mocks/space.rb +1 -1
- data/lib/rspec/mocks/version.rb +1 -1
- data/lib/rspec/mocks.rb +2 -1
- data/spec/rspec/mocks/and_yield_spec.rb +3 -3
- data/spec/rspec/mocks/any_instance_spec.rb +590 -0
- data/spec/rspec/mocks/any_number_of_times_spec.rb +22 -28
- data/spec/rspec/mocks/at_least_spec.rb +6 -0
- data/spec/rspec/mocks/at_most_spec.rb +6 -0
- data/spec/rspec/mocks/bug_report_10263_spec.rb +12 -14
- data/spec/rspec/mocks/bug_report_7611_spec.rb +2 -4
- data/spec/rspec/mocks/failing_argument_matchers_spec.rb +45 -46
- data/spec/rspec/mocks/nil_expectation_warning_spec.rb +1 -2
- data/spec/rspec/mocks/passing_argument_matchers_spec.rb +119 -122
- data/spec/rspec/mocks/precise_counts_spec.rb +6 -0
- data/spec/rspec/mocks/serialization_spec.rb +21 -3
- data/spec/rspec/mocks/stub_chain_spec.rb +72 -37
- data/spec/rspec/mocks/stub_spec.rb +64 -61
- data/spec/rspec/mocks/to_ary_spec.rb +31 -0
- metadata +24 -11
- data/spec/rspec/mocks/bug_report_7805_spec.rb +0 -22
- data/spec/rspec/mocks/bug_report_8302_spec.rb +0 -26
|
@@ -3,30 +3,27 @@ require 'spec_helper'
|
|
|
3
3
|
module RSpec
|
|
4
4
|
module Mocks
|
|
5
5
|
describe "A chained method stub" do
|
|
6
|
-
|
|
7
|
-
@subject = Object.new
|
|
8
|
-
end
|
|
9
|
-
|
|
6
|
+
subject { Object.new }
|
|
10
7
|
|
|
11
8
|
context "with one method in chain" do
|
|
12
9
|
context "using and_return" do
|
|
13
10
|
it "returns expected value from chaining only one method call" do
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
subject.stub_chain(:msg1).and_return(:return_value)
|
|
12
|
+
subject.msg1.should equal(:return_value)
|
|
16
13
|
end
|
|
17
14
|
end
|
|
18
15
|
|
|
19
16
|
context "using a block" do
|
|
20
17
|
it "returns the correct value" do
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
subject.stub_chain(:msg1) { :return_value }
|
|
19
|
+
subject.msg1.should equal(:return_value)
|
|
23
20
|
end
|
|
24
21
|
end
|
|
25
22
|
|
|
26
23
|
context "using a hash" do
|
|
27
24
|
it "returns the value of the key/value pair" do
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
subject.stub_chain(:msg1 => :return_value)
|
|
26
|
+
subject.msg1.should equal(:return_value)
|
|
30
27
|
end
|
|
31
28
|
end
|
|
32
29
|
end
|
|
@@ -34,22 +31,22 @@ module RSpec
|
|
|
34
31
|
context "with two methods in chain" do
|
|
35
32
|
context "using and_return" do
|
|
36
33
|
it "returns expected value from chaining two method calls" do
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
subject.stub_chain(:msg1, :msg2).and_return(:return_value)
|
|
35
|
+
subject.msg1.msg2.should equal(:return_value)
|
|
39
36
|
end
|
|
40
37
|
end
|
|
41
38
|
|
|
42
39
|
context "using a block" do
|
|
43
40
|
it "returns the correct value" do
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
subject.stub_chain(:msg1, :msg2) { :return_value }
|
|
42
|
+
subject.msg1.msg2.should equal(:return_value)
|
|
46
43
|
end
|
|
47
44
|
end
|
|
48
45
|
|
|
49
46
|
context "using a hash" do
|
|
50
47
|
it "returns the value of the key/value pair" do
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
subject.stub_chain(:msg1, :msg2 => :return_value)
|
|
49
|
+
subject.msg1.msg2.should equal(:return_value)
|
|
53
50
|
end
|
|
54
51
|
end
|
|
55
52
|
end
|
|
@@ -57,57 +54,95 @@ module RSpec
|
|
|
57
54
|
context "with four methods in chain" do
|
|
58
55
|
context "using and_return" do
|
|
59
56
|
it "returns expected value from chaining two method calls" do
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
subject.stub_chain(:msg1, :msg2, :msg3, :msg4).and_return(:return_value)
|
|
58
|
+
subject.msg1.msg2.msg3.msg4.should equal(:return_value)
|
|
62
59
|
end
|
|
63
60
|
end
|
|
64
61
|
|
|
65
62
|
context "using a block" do
|
|
66
63
|
it "returns the correct value" do
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
subject.stub_chain(:msg1, :msg2, :msg3, :msg4) { :return_value }
|
|
65
|
+
subject.msg1.msg2.msg3.msg4.should equal(:return_value)
|
|
69
66
|
end
|
|
70
67
|
end
|
|
71
68
|
|
|
72
69
|
context "using a hash" do
|
|
73
70
|
it "returns the value of the key/value pair" do
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
subject.stub_chain(:msg1, :msg2, :msg3, :msg4 => :return_value)
|
|
72
|
+
subject.msg1.msg2.msg3.msg4.should equal(:return_value)
|
|
76
73
|
end
|
|
77
74
|
end
|
|
78
75
|
|
|
79
76
|
context "using a hash with a string key" do
|
|
80
77
|
it "returns the value of the key/value pair" do
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
subject.stub_chain("msg1.msg2.msg3.msg4" => :return_value)
|
|
79
|
+
subject.msg1.msg2.msg3.msg4.should equal(:return_value)
|
|
83
80
|
end
|
|
84
81
|
end
|
|
85
82
|
end
|
|
86
83
|
|
|
87
84
|
it "returns expected value from chaining four method calls" do
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
subject.stub_chain(:msg1, :msg2, :msg3, :msg4).and_return(:return_value)
|
|
86
|
+
subject.msg1.msg2.msg3.msg4.should equal(:return_value)
|
|
90
87
|
end
|
|
91
88
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
context "with messages shared across multiple chains" do
|
|
90
|
+
context "using and_return" do
|
|
91
|
+
context "starting with the same message" do
|
|
92
|
+
it "returns expected value" do
|
|
93
|
+
subject.stub_chain(:msg1, :msg2, :msg3).and_return(:first)
|
|
94
|
+
subject.stub_chain(:msg1, :msg2, :msg4).and_return(:second)
|
|
95
|
+
|
|
96
|
+
subject.msg1.msg2.msg3.should equal(:first)
|
|
97
|
+
subject.msg1.msg2.msg4.should equal(:second)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
context "starting with the different messages" do
|
|
102
|
+
it "returns expected value" do
|
|
103
|
+
subject.stub_chain(:msg1, :msg2, :msg3).and_return(:first)
|
|
104
|
+
subject.stub_chain(:msg4, :msg2, :msg3).and_return(:second)
|
|
105
|
+
|
|
106
|
+
subject.msg1.msg2.msg3.should equal(:first)
|
|
107
|
+
subject.msg4.msg2.msg3.should equal(:second)
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
context "using => value" do
|
|
113
|
+
context "starting with the same message" do
|
|
114
|
+
it "returns expected value", :focus => true do
|
|
115
|
+
subject.stub_chain(:msg1, :msg2, :msg3 => :first)
|
|
116
|
+
subject.stub_chain(:msg1, :msg2, :msg4 => :second)
|
|
117
|
+
|
|
118
|
+
subject.msg1.msg2.msg3.should equal(:first)
|
|
119
|
+
subject.msg1.msg2.msg4.should equal(:second)
|
|
120
|
+
end
|
|
121
|
+
end
|
|
95
122
|
|
|
96
|
-
|
|
97
|
-
|
|
123
|
+
context "starting with different messages" do
|
|
124
|
+
it "returns expected value", :focus => true do
|
|
125
|
+
subject.stub_chain(:msg1, :msg2, :msg3 => :first)
|
|
126
|
+
subject.stub_chain(:msg4, :msg2, :msg3 => :second)
|
|
127
|
+
|
|
128
|
+
subject.msg1.msg2.msg3.should equal(:first)
|
|
129
|
+
subject.msg4.msg2.msg3.should equal(:second)
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
98
133
|
end
|
|
99
134
|
|
|
100
135
|
it "returns expected value when chain is a dot separated string, like stub_chain('msg1.msg2.msg3')" do
|
|
101
|
-
|
|
102
|
-
|
|
136
|
+
subject.stub_chain("msg1.msg2.msg3").and_return(:return_value)
|
|
137
|
+
subject.msg1.msg2.msg3.should equal(:return_value)
|
|
103
138
|
end
|
|
104
139
|
|
|
105
140
|
it "returns expected value from two chains with shared messages at the beginning" do
|
|
106
|
-
|
|
107
|
-
|
|
141
|
+
subject.stub_chain(:msg1, :msg2, :msg3, :msg4).and_return(:first)
|
|
142
|
+
subject.stub_chain(:msg1, :msg2, :msg3, :msg5).and_return(:second)
|
|
108
143
|
|
|
109
|
-
|
|
110
|
-
|
|
144
|
+
subject.msg1.msg2.msg3.msg4.should equal(:first)
|
|
145
|
+
subject.msg1.msg2.msg3.msg5.should equal(:second)
|
|
111
146
|
end
|
|
112
147
|
end
|
|
113
148
|
end
|
|
@@ -31,7 +31,7 @@ module RSpec
|
|
|
31
31
|
|
|
32
32
|
[:stub!, :stub].each do |method|
|
|
33
33
|
describe "using #{method}" do
|
|
34
|
-
it "returns
|
|
34
|
+
it "returns declared value when message is received" do
|
|
35
35
|
@instance.send(method, :msg).and_return(:return_value)
|
|
36
36
|
@instance.msg.should equal(:return_value)
|
|
37
37
|
@instance.rspec_verify
|
|
@@ -39,92 +39,95 @@ module RSpec
|
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
it "
|
|
42
|
+
it "instructs an instance to respond_to the message" do
|
|
43
|
+
@instance.stub(:msg)
|
|
44
|
+
@instance.should respond_to(:msg)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it "instructs a class object to respond_to the message" do
|
|
48
|
+
@class.stub(:msg)
|
|
49
|
+
@class.should respond_to(:msg)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "ignores when expected message is received with no args" do
|
|
43
53
|
@instance.stub(:msg)
|
|
44
54
|
@instance.msg
|
|
45
|
-
|
|
55
|
+
expect do
|
|
46
56
|
@instance.rspec_verify
|
|
47
|
-
end.
|
|
57
|
+
end.not_to raise_error
|
|
48
58
|
end
|
|
49
59
|
|
|
50
60
|
it "ignores when message is received with args" do
|
|
51
61
|
@instance.stub(:msg)
|
|
52
62
|
@instance.msg(:an_arg)
|
|
53
|
-
|
|
63
|
+
expect do
|
|
54
64
|
@instance.rspec_verify
|
|
55
|
-
end.
|
|
65
|
+
end.not_to raise_error
|
|
56
66
|
end
|
|
57
67
|
|
|
58
68
|
it "ignores when expected message is not received" do
|
|
59
69
|
@instance.stub(:msg)
|
|
60
|
-
|
|
70
|
+
expect do
|
|
61
71
|
@instance.rspec_verify
|
|
62
|
-
end.
|
|
72
|
+
end.not_to raise_error
|
|
63
73
|
end
|
|
64
74
|
|
|
65
75
|
it "handles multiple stubbed methods" do
|
|
66
76
|
@instance.stub(:msg1 => 1, :msg2 => 2)
|
|
67
|
-
@instance.msg1.should
|
|
68
|
-
@instance.msg2.should
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
it "clears itself when verified" do
|
|
72
|
-
@instance.stub(:this_should_go).and_return(:blah)
|
|
73
|
-
@instance.this_should_go.should == :blah
|
|
74
|
-
@instance.rspec_verify
|
|
75
|
-
lambda do
|
|
76
|
-
@instance.this_should_go
|
|
77
|
-
end.should raise_error(NameError)
|
|
77
|
+
@instance.msg1.should eq(1)
|
|
78
|
+
@instance.msg2.should eq(2)
|
|
78
79
|
end
|
|
79
80
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
end
|
|
81
|
+
describe "#rspec_reset" do
|
|
82
|
+
it "removes stubbed methods that didn't exist" do
|
|
83
|
+
@instance.stub(:non_existent_method)
|
|
84
|
+
@instance.rspec_reset
|
|
85
|
+
@instance.should_not respond_to(:non_existent_method)
|
|
86
|
+
end
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
@instance.msg.should == return_values[2]
|
|
95
|
-
@instance.msg.should == return_values[2]
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
it "reverts to original instance method if there is one" do
|
|
99
|
-
@instance.existing_instance_method.should equal(:original_value)
|
|
100
|
-
@instance.stub(:existing_instance_method).and_return(:mock_value)
|
|
101
|
-
@instance.existing_instance_method.should equal(:mock_value)
|
|
102
|
-
@instance.rspec_verify
|
|
103
|
-
@instance.existing_instance_method.should equal(:original_value)
|
|
104
|
-
end
|
|
88
|
+
it "restores existing instance methods" do
|
|
89
|
+
# See bug reports 8302 adn 7805
|
|
90
|
+
@instance.stub(:existing_instance_method) { :stub_value }
|
|
91
|
+
@instance.rspec_reset
|
|
92
|
+
@instance.existing_instance_method.should eq(:original_value)
|
|
93
|
+
end
|
|
105
94
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
95
|
+
it "restores existing private instance methods" do
|
|
96
|
+
# See bug reports 8302 adn 7805
|
|
97
|
+
@instance.stub(:existing_private_instance_method) { :stub_value }
|
|
98
|
+
@instance.rspec_reset
|
|
99
|
+
@instance.send(:existing_private_instance_method).should eq(:original_value)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
it "restores existing class methods" do
|
|
103
|
+
# See bug reports 8302 adn 7805
|
|
104
|
+
@class.stub(:existing_class_method) { :stub_value }
|
|
105
|
+
@class.rspec_reset
|
|
106
|
+
@class.existing_class_method.should eq(:original_value)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
it "restores existing private class methods" do
|
|
110
|
+
# See bug reports 8302 adn 7805
|
|
111
|
+
@class.stub(:existing_private_class_method) { :stub_value }
|
|
112
|
+
@class.rspec_reset
|
|
113
|
+
@class.send(:existing_private_class_method).should eq(:original_value)
|
|
114
|
+
end
|
|
112
115
|
end
|
|
113
116
|
|
|
114
|
-
it "
|
|
115
|
-
@
|
|
116
|
-
@
|
|
117
|
-
@
|
|
118
|
-
@
|
|
119
|
-
@class.existing_class_method.should equal(:original_value)
|
|
117
|
+
it "returns values in order to consecutive calls" do
|
|
118
|
+
@instance.stub(:msg).and_return("1",2,:three)
|
|
119
|
+
@instance.msg.should eq("1")
|
|
120
|
+
@instance.msg.should eq(2)
|
|
121
|
+
@instance.msg.should eq(:three)
|
|
120
122
|
end
|
|
121
123
|
|
|
122
|
-
it "
|
|
123
|
-
@
|
|
124
|
-
@
|
|
125
|
-
@
|
|
126
|
-
@
|
|
127
|
-
@
|
|
124
|
+
it "keeps returning last value in consecutive calls" do
|
|
125
|
+
@instance.stub(:msg).and_return("1",2,:three)
|
|
126
|
+
@instance.msg.should eq("1")
|
|
127
|
+
@instance.msg.should eq(2)
|
|
128
|
+
@instance.msg.should eq(:three)
|
|
129
|
+
@instance.msg.should eq(:three)
|
|
130
|
+
@instance.msg.should eq(:three)
|
|
128
131
|
end
|
|
129
132
|
|
|
130
133
|
it "yields a specified object" do
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe "a double receiving to_ary" do
|
|
4
|
+
shared_examples "to_ary" do
|
|
5
|
+
it "returns nil" do
|
|
6
|
+
expect do
|
|
7
|
+
obj.to_ary.should be_nil
|
|
8
|
+
end.to raise_error(NoMethodError)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "can be overridden with a stub" do
|
|
12
|
+
obj.stub(:to_ary) { :non_nil_value }
|
|
13
|
+
obj.to_ary.should be(:non_nil_value)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "supports Array#flatten" do
|
|
17
|
+
obj = double('foo')
|
|
18
|
+
[obj].flatten.should eq([obj])
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
context "double as_null_object" do
|
|
23
|
+
let(:obj) { double('obj').as_null_object }
|
|
24
|
+
include_examples "to_ary"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
context "double without as_null_object" do
|
|
28
|
+
let(:obj) { double('obj') }
|
|
29
|
+
include_examples "to_ary"
|
|
30
|
+
end
|
|
31
|
+
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-mocks
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
5
|
-
prerelease:
|
|
4
|
+
hash: 23
|
|
5
|
+
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 2
|
|
8
|
-
-
|
|
8
|
+
- 6
|
|
9
9
|
- 0
|
|
10
|
-
version: 2.
|
|
10
|
+
version: 2.6.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- David Chelimsky
|
|
@@ -16,7 +16,7 @@ autorequire:
|
|
|
16
16
|
bindir: bin
|
|
17
17
|
cert_chain: []
|
|
18
18
|
|
|
19
|
-
date: 2011-
|
|
19
|
+
date: 2011-05-12 00:00:00 -05:00
|
|
20
20
|
default_executable:
|
|
21
21
|
dependencies: []
|
|
22
22
|
|
|
@@ -32,6 +32,7 @@ files:
|
|
|
32
32
|
- .autotest
|
|
33
33
|
- .document
|
|
34
34
|
- .gitignore
|
|
35
|
+
- .travis.yml
|
|
35
36
|
- Gemfile
|
|
36
37
|
- Guardfile
|
|
37
38
|
- License.txt
|
|
@@ -44,23 +45,30 @@ files:
|
|
|
44
45
|
- features/README.markdown
|
|
45
46
|
- features/Upgrade.md
|
|
46
47
|
- features/message_expectations/README.md
|
|
48
|
+
- features/message_expectations/any_instance.feature
|
|
47
49
|
- features/message_expectations/block_local_expectations.feature.pending
|
|
48
50
|
- features/message_expectations/expect_message.feature
|
|
49
51
|
- features/message_expectations/warn_when_expectation_is_set_on_nil.feature
|
|
50
52
|
- features/method_stubs/README.md
|
|
53
|
+
- features/method_stubs/any_instance.feature
|
|
54
|
+
- features/method_stubs/as_null_object.feature
|
|
51
55
|
- features/method_stubs/simple_return_value.feature
|
|
52
56
|
- features/method_stubs/stub_chain.feature
|
|
53
57
|
- features/method_stubs/stub_implementation.feature
|
|
58
|
+
- features/method_stubs/to_ary.feature
|
|
54
59
|
- features/outside_rspec/configuration.feature
|
|
55
60
|
- features/outside_rspec/standalone.feature
|
|
61
|
+
- features/step_definitions/additional_cli_steps.rb
|
|
56
62
|
- features/support/env.rb
|
|
57
63
|
- lib/rspec/mocks.rb
|
|
64
|
+
- lib/rspec/mocks/any_instance.rb
|
|
58
65
|
- lib/rspec/mocks/argument_expectation.rb
|
|
59
66
|
- lib/rspec/mocks/argument_matchers.rb
|
|
60
67
|
- lib/rspec/mocks/error_generator.rb
|
|
61
68
|
- lib/rspec/mocks/errors.rb
|
|
62
69
|
- lib/rspec/mocks/extensions/instance_exec.rb
|
|
63
70
|
- lib/rspec/mocks/extensions/marshal.rb
|
|
71
|
+
- lib/rspec/mocks/extensions/psych.rb
|
|
64
72
|
- lib/rspec/mocks/framework.rb
|
|
65
73
|
- lib/rspec/mocks/message_expectation.rb
|
|
66
74
|
- lib/rspec/mocks/method_double.rb
|
|
@@ -76,6 +84,7 @@ files:
|
|
|
76
84
|
- lib/spec/mocks.rb
|
|
77
85
|
- rspec-mocks.gemspec
|
|
78
86
|
- spec/rspec/mocks/and_yield_spec.rb
|
|
87
|
+
- spec/rspec/mocks/any_instance_spec.rb
|
|
79
88
|
- spec/rspec/mocks/any_number_of_times_spec.rb
|
|
80
89
|
- spec/rspec/mocks/argument_expectation_spec.rb
|
|
81
90
|
- spec/rspec/mocks/at_least_spec.rb
|
|
@@ -87,9 +96,7 @@ files:
|
|
|
87
96
|
- spec/rspec/mocks/bug_report_496_spec.rb
|
|
88
97
|
- spec/rspec/mocks/bug_report_600_spec.rb
|
|
89
98
|
- spec/rspec/mocks/bug_report_7611_spec.rb
|
|
90
|
-
- spec/rspec/mocks/bug_report_7805_spec.rb
|
|
91
99
|
- spec/rspec/mocks/bug_report_8165_spec.rb
|
|
92
|
-
- spec/rspec/mocks/bug_report_8302_spec.rb
|
|
93
100
|
- spec/rspec/mocks/bug_report_830_spec.rb
|
|
94
101
|
- spec/rspec/mocks/bug_report_957_spec.rb
|
|
95
102
|
- spec/rspec/mocks/double_spec.rb
|
|
@@ -115,6 +122,7 @@ files:
|
|
|
115
122
|
- spec/rspec/mocks/stub_implementation_spec.rb
|
|
116
123
|
- spec/rspec/mocks/stub_spec.rb
|
|
117
124
|
- spec/rspec/mocks/stubbed_message_expectations_spec.rb
|
|
125
|
+
- spec/rspec/mocks/to_ary_spec.rb
|
|
118
126
|
- spec/rspec/mocks/twice_counts_spec.rb
|
|
119
127
|
- spec/rspec/mocks_spec.rb
|
|
120
128
|
- spec/spec_helper.rb
|
|
@@ -149,26 +157,32 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
149
157
|
requirements: []
|
|
150
158
|
|
|
151
159
|
rubyforge_project: rspec
|
|
152
|
-
rubygems_version: 1.
|
|
160
|
+
rubygems_version: 1.6.2
|
|
153
161
|
signing_key:
|
|
154
162
|
specification_version: 3
|
|
155
|
-
summary: rspec-mocks-2.
|
|
163
|
+
summary: rspec-mocks-2.6.0
|
|
156
164
|
test_files:
|
|
157
165
|
- features/Changelog.md
|
|
158
166
|
- features/README.markdown
|
|
159
167
|
- features/Upgrade.md
|
|
160
168
|
- features/message_expectations/README.md
|
|
169
|
+
- features/message_expectations/any_instance.feature
|
|
161
170
|
- features/message_expectations/block_local_expectations.feature.pending
|
|
162
171
|
- features/message_expectations/expect_message.feature
|
|
163
172
|
- features/message_expectations/warn_when_expectation_is_set_on_nil.feature
|
|
164
173
|
- features/method_stubs/README.md
|
|
174
|
+
- features/method_stubs/any_instance.feature
|
|
175
|
+
- features/method_stubs/as_null_object.feature
|
|
165
176
|
- features/method_stubs/simple_return_value.feature
|
|
166
177
|
- features/method_stubs/stub_chain.feature
|
|
167
178
|
- features/method_stubs/stub_implementation.feature
|
|
179
|
+
- features/method_stubs/to_ary.feature
|
|
168
180
|
- features/outside_rspec/configuration.feature
|
|
169
181
|
- features/outside_rspec/standalone.feature
|
|
182
|
+
- features/step_definitions/additional_cli_steps.rb
|
|
170
183
|
- features/support/env.rb
|
|
171
184
|
- spec/rspec/mocks/and_yield_spec.rb
|
|
185
|
+
- spec/rspec/mocks/any_instance_spec.rb
|
|
172
186
|
- spec/rspec/mocks/any_number_of_times_spec.rb
|
|
173
187
|
- spec/rspec/mocks/argument_expectation_spec.rb
|
|
174
188
|
- spec/rspec/mocks/at_least_spec.rb
|
|
@@ -180,9 +194,7 @@ test_files:
|
|
|
180
194
|
- spec/rspec/mocks/bug_report_496_spec.rb
|
|
181
195
|
- spec/rspec/mocks/bug_report_600_spec.rb
|
|
182
196
|
- spec/rspec/mocks/bug_report_7611_spec.rb
|
|
183
|
-
- spec/rspec/mocks/bug_report_7805_spec.rb
|
|
184
197
|
- spec/rspec/mocks/bug_report_8165_spec.rb
|
|
185
|
-
- spec/rspec/mocks/bug_report_8302_spec.rb
|
|
186
198
|
- spec/rspec/mocks/bug_report_830_spec.rb
|
|
187
199
|
- spec/rspec/mocks/bug_report_957_spec.rb
|
|
188
200
|
- spec/rspec/mocks/double_spec.rb
|
|
@@ -208,6 +220,7 @@ test_files:
|
|
|
208
220
|
- spec/rspec/mocks/stub_implementation_spec.rb
|
|
209
221
|
- spec/rspec/mocks/stub_spec.rb
|
|
210
222
|
- spec/rspec/mocks/stubbed_message_expectations_spec.rb
|
|
223
|
+
- spec/rspec/mocks/to_ary_spec.rb
|
|
211
224
|
- spec/rspec/mocks/twice_counts_spec.rb
|
|
212
225
|
- spec/rspec/mocks_spec.rb
|
|
213
226
|
- spec/spec_helper.rb
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module Bug7805
|
|
4
|
-
#This is really a duplicate of 8302
|
|
5
|
-
|
|
6
|
-
describe "Stubs should correctly restore module methods" do
|
|
7
|
-
it "1 - stub the open method" do
|
|
8
|
-
File.stub(:open).and_return("something")
|
|
9
|
-
File.open.should == "something"
|
|
10
|
-
end
|
|
11
|
-
it "2 - use File.open to create example.txt" do
|
|
12
|
-
filename = "#{File.dirname(__FILE__)}/example-#{Time.new.to_i}.txt"
|
|
13
|
-
File.exist?(filename).should be_false
|
|
14
|
-
file = File.open(filename,'w')
|
|
15
|
-
file.close
|
|
16
|
-
File.exist?(filename).should be_true
|
|
17
|
-
File.delete(filename)
|
|
18
|
-
File.exist?(filename).should be_false
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module Bug8302
|
|
4
|
-
describe "Bug report 8302:" do
|
|
5
|
-
class Foo
|
|
6
|
-
def Foo.class_method(arg)
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def instance_bar(arg)
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it "class method is not restored correctly when proxied" do
|
|
14
|
-
Foo.should_not_receive(:class_method).with(Array.new)
|
|
15
|
-
Foo.rspec_verify
|
|
16
|
-
Foo.class_method(Array.new)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it "instance method is not restored correctly when proxied" do
|
|
20
|
-
foo = Foo.new
|
|
21
|
-
foo.should_not_receive(:instance_bar).with(Array.new)
|
|
22
|
-
foo.rspec_verify
|
|
23
|
-
foo.instance_bar(Array.new)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|