rspec-mocks 3.0.0.beta2 → 3.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Changelog.md +104 -36
- data/README.md +35 -4
- data/lib/rspec/mocks.rb +52 -13
- data/lib/rspec/mocks/any_instance.rb +10 -0
- data/lib/rspec/mocks/any_instance/chain.rb +17 -0
- data/lib/rspec/mocks/any_instance/expect_chain_chain.rb +1 -1
- data/lib/rspec/mocks/any_instance/expectation_chain.rb +9 -6
- data/lib/rspec/mocks/any_instance/message_chains.rb +10 -1
- data/lib/rspec/mocks/any_instance/proxy.rb +112 -0
- data/lib/rspec/mocks/any_instance/recorder.rb +49 -18
- data/lib/rspec/mocks/any_instance/stub_chain.rb +5 -3
- data/lib/rspec/mocks/any_instance/stub_chain_chain.rb +1 -1
- data/lib/rspec/mocks/argument_list_matcher.rb +5 -3
- data/lib/rspec/mocks/argument_matchers.rb +28 -12
- data/lib/rspec/mocks/configuration.rb +29 -0
- data/lib/rspec/mocks/error_generator.rb +2 -5
- data/lib/rspec/mocks/example_methods.rb +122 -13
- data/lib/rspec/mocks/instance_method_stasher.rb +26 -2
- data/lib/rspec/mocks/marshal_extension.rb +41 -0
- data/lib/rspec/mocks/matchers/expectation_customization.rb +20 -0
- data/lib/rspec/mocks/matchers/receive.rb +6 -20
- data/lib/rspec/mocks/matchers/receive_message_chain.rb +7 -5
- data/lib/rspec/mocks/matchers/receive_messages.rb +1 -2
- data/lib/rspec/mocks/message_chain.rb +9 -9
- data/lib/rspec/mocks/message_expectation.rb +6 -5
- data/lib/rspec/mocks/method_double.rb +67 -10
- data/lib/rspec/mocks/method_reference.rb +1 -1
- data/lib/rspec/mocks/mutate_const.rb +10 -14
- data/lib/rspec/mocks/object_reference.rb +7 -4
- data/lib/rspec/mocks/proxy.rb +95 -8
- data/lib/rspec/mocks/space.rb +58 -9
- data/lib/rspec/mocks/syntax.rb +128 -210
- data/lib/rspec/mocks/targets.rb +6 -8
- data/lib/rspec/mocks/test_double.rb +16 -25
- data/lib/rspec/mocks/verifying_double.rb +15 -12
- data/lib/rspec/mocks/verifying_message_expecation.rb +3 -3
- data/lib/rspec/mocks/verifying_proxy.rb +23 -17
- data/lib/rspec/mocks/version.rb +3 -1
- metadata +29 -257
- metadata.gz.sig +0 -0
- data/features/README.md +0 -75
- data/features/Scope.md +0 -17
- data/features/Upgrade.md +0 -22
- data/features/argument_matchers/README.md +0 -27
- data/features/argument_matchers/explicit.feature +0 -59
- data/features/argument_matchers/general_matchers.feature +0 -85
- data/features/argument_matchers/type_matchers.feature +0 -26
- data/features/message_expectations/README.md +0 -75
- data/features/message_expectations/allow_any_instance_of.feature +0 -26
- data/features/message_expectations/any_instance.feature +0 -43
- data/features/message_expectations/block_local_expectations.feature.pending +0 -55
- data/features/message_expectations/call_original.feature +0 -23
- data/features/message_expectations/expect_message_using_expect.feature +0 -107
- data/features/message_expectations/expect_message_using_should_receive.feature +0 -118
- data/features/message_expectations/message_chains_using_expect.feature +0 -49
- data/features/message_expectations/receive_counts.feature +0 -209
- data/features/message_expectations/warn_when_expectation_is_set_on_nil.feature +0 -50
- data/features/method_stubs/README.md +0 -77
- data/features/method_stubs/allow_any_instance_of.feature +0 -136
- data/features/method_stubs/as_null_object.feature +0 -40
- data/features/method_stubs/receive_message_chain.feature +0 -51
- data/features/method_stubs/simple_return_value_with_allow.feature +0 -44
- data/features/method_stubs/simple_return_value_with_stub.feature +0 -64
- data/features/method_stubs/stub_implementation.feature +0 -48
- data/features/method_stubs/to_ary.feature +0 -51
- data/features/mutating_constants/README.md +0 -82
- data/features/mutating_constants/hiding_defined_constant.feature +0 -64
- data/features/mutating_constants/stub_defined_constant.feature +0 -78
- data/features/mutating_constants/stub_undefined_constant.feature +0 -50
- data/features/outside_rspec/standalone.feature +0 -33
- data/features/spies/spy_partial_mock_method.feature +0 -34
- data/features/spies/spy_pure_mock_method.feature +0 -76
- data/features/spies/spy_unstubbed_method.feature +0 -18
- data/features/step_definitions/additional_cli_steps.rb +0 -11
- data/features/support/env.rb +0 -22
- data/features/support/rubinius.rb +0 -6
- data/features/test_frameworks/test_unit.feature +0 -54
- data/features/verifying_doubles/README.md +0 -17
- data/features/verifying_doubles/class_doubles.feature +0 -73
- data/features/verifying_doubles/dynamic_classes.feature +0 -71
- data/features/verifying_doubles/instance_doubles.feature +0 -103
- data/features/verifying_doubles/object_doubles.feature +0 -65
- data/features/verifying_doubles/partial_doubles.feature +0 -34
- data/lib/rspec/mocks/extensions/marshal.rb +0 -17
- data/lib/rspec/mocks/framework.rb +0 -35
- data/lib/rspec/mocks/method_signature_verifier.rb +0 -207
- data/lib/rspec/mocks/ruby_features.rb +0 -24
- data/spec/rspec/mocks/and_call_original_spec.rb +0 -268
- data/spec/rspec/mocks/and_return_spec.rb +0 -23
- data/spec/rspec/mocks/and_yield_spec.rb +0 -126
- data/spec/rspec/mocks/any_instance/message_chains_spec.rb +0 -41
- data/spec/rspec/mocks/any_instance_spec.rb +0 -1045
- data/spec/rspec/mocks/array_including_matcher_spec.rb +0 -41
- data/spec/rspec/mocks/at_least_spec.rb +0 -123
- data/spec/rspec/mocks/at_most_spec.rb +0 -90
- data/spec/rspec/mocks/before_all_spec.rb +0 -132
- data/spec/rspec/mocks/block_return_value_spec.rb +0 -70
- data/spec/rspec/mocks/combining_implementation_instructions_spec.rb +0 -204
- data/spec/rspec/mocks/configuration_spec.rb +0 -242
- data/spec/rspec/mocks/double_spec.rb +0 -874
- data/spec/rspec/mocks/example_methods_spec.rb +0 -13
- data/spec/rspec/mocks/extensions/marshal_spec.rb +0 -54
- data/spec/rspec/mocks/failing_argument_matchers_spec.rb +0 -184
- data/spec/rspec/mocks/hash_excluding_matcher_spec.rb +0 -67
- data/spec/rspec/mocks/hash_including_matcher_spec.rb +0 -94
- data/spec/rspec/mocks/instance_method_stasher_spec.rb +0 -74
- data/spec/rspec/mocks/matchers/have_received_spec.rb +0 -347
- data/spec/rspec/mocks/matchers/receive_message_chain_spec.rb +0 -198
- data/spec/rspec/mocks/matchers/receive_messages_spec.rb +0 -140
- data/spec/rspec/mocks/matchers/receive_spec.rb +0 -418
- data/spec/rspec/mocks/method_signature_verifier_spec.rb +0 -272
- data/spec/rspec/mocks/methods_spec.rb +0 -26
- data/spec/rspec/mocks/mock_expectation_error_spec.rb +0 -22
- data/spec/rspec/mocks/mock_ordering_spec.rb +0 -114
- data/spec/rspec/mocks/multiple_return_value_spec.rb +0 -132
- data/spec/rspec/mocks/mutate_const_spec.rb +0 -542
- data/spec/rspec/mocks/nil_expectation_warning_spec.rb +0 -52
- data/spec/rspec/mocks/null_object_mock_spec.rb +0 -133
- data/spec/rspec/mocks/once_counts_spec.rb +0 -52
- data/spec/rspec/mocks/options_hash_spec.rb +0 -35
- data/spec/rspec/mocks/order_group_spec.rb +0 -27
- data/spec/rspec/mocks/partial_double_spec.rb +0 -308
- data/spec/rspec/mocks/partial_double_using_mocks_directly_spec.rb +0 -95
- data/spec/rspec/mocks/passing_argument_matchers_spec.rb +0 -145
- data/spec/rspec/mocks/precise_counts_spec.rb +0 -68
- data/spec/rspec/mocks/record_messages_spec.rb +0 -26
- data/spec/rspec/mocks/serialization_spec.rb +0 -90
- data/spec/rspec/mocks/space_spec.rb +0 -244
- data/spec/rspec/mocks/stash_spec.rb +0 -46
- data/spec/rspec/mocks/stub_chain_spec.rb +0 -168
- data/spec/rspec/mocks/stub_implementation_spec.rb +0 -81
- data/spec/rspec/mocks/stub_spec.rb +0 -327
- data/spec/rspec/mocks/stubbed_message_expectations_spec.rb +0 -58
- data/spec/rspec/mocks/syntax_agnostic_message_matchers_spec.rb +0 -101
- data/spec/rspec/mocks/syntax_spec.rb +0 -19
- data/spec/rspec/mocks/test_double_spec.rb +0 -49
- data/spec/rspec/mocks/to_ary_spec.rb +0 -54
- data/spec/rspec/mocks/twice_counts_spec.rb +0 -66
- data/spec/rspec/mocks/verifying_double_spec.rb +0 -590
- data/spec/rspec/mocks/verifying_message_expecation_spec.rb +0 -69
- data/spec/rspec/mocks_spec.rb +0 -192
- data/spec/spec_helper.rb +0 -121
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module RSpec
|
4
|
-
module Mocks
|
5
|
-
describe VerifyingMessageExpectation do
|
6
|
-
describe '#with' do
|
7
|
-
let(:error_generator) { double.as_null_object }
|
8
|
-
let(:string_module_reference) { DirectModuleReference.new(String) }
|
9
|
-
|
10
|
-
subject {
|
11
|
-
null = double.as_null_object
|
12
|
-
|
13
|
-
described_class.new(error_generator, null, null, null)
|
14
|
-
}
|
15
|
-
|
16
|
-
describe 'when expected method is not loaded' do
|
17
|
-
it 'allows any arguments to be expected' do
|
18
|
-
subject.with(:foo, :bar)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe 'when arity match fails' do
|
23
|
-
it 'raises error' do
|
24
|
-
args = ["abc123", "xyz987"]
|
25
|
-
subject.method_reference = InstanceMethodReference.new(string_module_reference, :replace)
|
26
|
-
expect(error_generator).to receive(:raise_invalid_arguments_error).
|
27
|
-
with(instance_of(MethodSignatureVerifier))
|
28
|
-
|
29
|
-
subject.with(*args)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe 'when called with arguments' do
|
34
|
-
it 'matches arity against the number of arguments' do
|
35
|
-
subject.method_reference = InstanceMethodReference.new(string_module_reference, :replace)
|
36
|
-
expect(error_generator).not_to receive(:raise_invalid_arguments_error)
|
37
|
-
|
38
|
-
subject.with("abc123")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe 'when called with any arguments matcher' do
|
43
|
-
it 'does not try to match arity' do
|
44
|
-
subject.method_reference = InstanceMethodReference.new(string_module_reference, :replace)
|
45
|
-
subject.with(any_args)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe 'when called with no arguments matcher' do
|
50
|
-
it 'matches arity to 0' do
|
51
|
-
subject.method_reference = InstanceMethodReference.new(string_module_reference, :replace)
|
52
|
-
expect(error_generator).to receive(:raise_invalid_arguments_error).
|
53
|
-
with(instance_of(MethodSignatureVerifier))
|
54
|
-
|
55
|
-
subject.with(no_args)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe 'when called with no arguments and no block' do
|
60
|
-
it 'raises' do
|
61
|
-
expect {
|
62
|
-
subject.with
|
63
|
-
}.to raise_error(ArgumentError)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
data/spec/rspec/mocks_spec.rb
DELETED
@@ -1,192 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe RSpec::Mocks do
|
4
|
-
describe ".verify" do
|
5
|
-
it "delegates to the space" do
|
6
|
-
foo = double
|
7
|
-
foo.should_receive(:bar)
|
8
|
-
expect do
|
9
|
-
RSpec::Mocks.verify
|
10
|
-
end.to raise_error(RSpec::Mocks::MockExpectationError)
|
11
|
-
|
12
|
-
RSpec::Mocks.teardown # so the mocks aren't re-verified after this example
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe ".teardown" do
|
17
|
-
it "resets method stubs" do
|
18
|
-
string = "foo"
|
19
|
-
allow(string).to receive(:bar)
|
20
|
-
RSpec::Mocks.teardown
|
21
|
-
expect { string.bar }.to raise_error(NoMethodError)
|
22
|
-
end
|
23
|
-
|
24
|
-
it "does not put rspec-mocks into an inconsistent state when called extra times" do
|
25
|
-
RSpec::Mocks.teardown
|
26
|
-
RSpec::Mocks.teardown
|
27
|
-
RSpec::Mocks.teardown
|
28
|
-
|
29
|
-
string = "foo"
|
30
|
-
expect { allow(string).to receive(:bar) }.to raise_error(RSpec::Mocks::OutsideOfExampleError)
|
31
|
-
|
32
|
-
RSpec::Mocks.setup
|
33
|
-
allow(string).to receive(:bar).and_return(:baz)
|
34
|
-
expect(string.bar).to eq(:baz)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe ".setup" do
|
39
|
-
it 'starts a new space scope that is later removed by .teardown' do
|
40
|
-
old_space = RSpec::Mocks.space
|
41
|
-
RSpec::Mocks.setup
|
42
|
-
|
43
|
-
new_space = RSpec::Mocks.space
|
44
|
-
expect(new_space).not_to equal(old_space)
|
45
|
-
|
46
|
-
RSpec::Mocks.teardown
|
47
|
-
expect(RSpec::Mocks.space).to equal(old_space)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe ".configuration" do
|
52
|
-
it 'returns a memoized configuration instance' do
|
53
|
-
expect(RSpec::Mocks.configuration).to be_a(RSpec::Mocks::Configuration)
|
54
|
-
expect(RSpec::Mocks.configuration).to be(RSpec::Mocks.configuration)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe ".with_temporary_scope" do
|
59
|
-
context "in a before(:all) with a stubbed double" do
|
60
|
-
before(:all) do
|
61
|
-
RSpec::Mocks.with_temporary_scope do
|
62
|
-
@calculator = double
|
63
|
-
allow(@calculator).to receive(:add) { |a, b| a + b }
|
64
|
-
@sum = @calculator.add(3, 4)
|
65
|
-
end
|
66
|
-
|
67
|
-
capture_error { @calculator.add(1, 10) }
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'allows the stubbed double to be used' do
|
71
|
-
expect(@sum).to eq(7)
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'does not allow the double to be used in the examples' do
|
75
|
-
expect {
|
76
|
-
@calculator.add(1, 2)
|
77
|
-
}.to raise_error(RSpec::Mocks::ExpiredTestDoubleError)
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'does not allow the double to be used after the scope in before(:all)' do
|
81
|
-
expect(@error).to be_a(RSpec::Mocks::OutsideOfExampleError)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
context "in a before(:all) with a stubbed const" do
|
86
|
-
before(:all) do
|
87
|
-
RSpec::Mocks.with_temporary_scope do
|
88
|
-
stub_const("ValueX", 3)
|
89
|
-
stub_const("ValueY", 4)
|
90
|
-
@sum = ValueX + ValueY
|
91
|
-
end
|
92
|
-
|
93
|
-
capture_error { ValueX + ValueY }
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'allows the stubbed constants to be used' do
|
97
|
-
expect(@sum).to eq(7)
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'does not allow the stubbed constants to be used in the examples' do
|
101
|
-
expect(defined?(ValueX)).to be_falsey
|
102
|
-
expect(defined?(ValueY)).to be_falsey
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'does not allow the stubbed constants to be used after the scope in before(:all)' do
|
106
|
-
expect(@error).to be_a(NameError)
|
107
|
-
expect(@error.message).to include("ValueX")
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
context "in a before(:all) with a unmet mock expectation" do
|
112
|
-
before(:all) do
|
113
|
-
capture_error do
|
114
|
-
RSpec::Mocks.with_temporary_scope do
|
115
|
-
calculator = double
|
116
|
-
expect(calculator).to receive(:add)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
it 'fails with a mock expectation error' do
|
122
|
-
expect(@error).to be_a(RSpec::Mocks::MockExpectationError)
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
context "in a before(:all) with an any_instance stub" do
|
127
|
-
before(:all) do
|
128
|
-
RSpec::Mocks.with_temporary_scope do
|
129
|
-
allow_any_instance_of(String).to receive(:sum_with) { |val, x| val + x }
|
130
|
-
@sum = "foo".sum_with("bar")
|
131
|
-
end
|
132
|
-
|
133
|
-
capture_error { "you".sum_with("me") }
|
134
|
-
end
|
135
|
-
|
136
|
-
it 'allows the stub to be used' do
|
137
|
-
expect(@sum).to eq("foobar")
|
138
|
-
end
|
139
|
-
|
140
|
-
it 'does not allow the double to be used in the examples' do
|
141
|
-
expect {
|
142
|
-
"foo".sum_with("baz")
|
143
|
-
}.to raise_error(NameError, /sum_with/)
|
144
|
-
end
|
145
|
-
|
146
|
-
it 'does not allow the double to be used after the scope in before(:all)' do
|
147
|
-
expect(@error).to be_a(NameError)
|
148
|
-
expect(@error.message).to include("sum_with")
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
it 'tears down even if an error occurs' do
|
153
|
-
foo = Object.new
|
154
|
-
|
155
|
-
expect {
|
156
|
-
RSpec::Mocks.with_temporary_scope do
|
157
|
-
allow(foo).to receive(:bar)
|
158
|
-
raise "boom"
|
159
|
-
end
|
160
|
-
}.to raise_error("boom")
|
161
|
-
|
162
|
-
expect(foo).not_to respond_to(:bar)
|
163
|
-
end
|
164
|
-
|
165
|
-
it 'does not verify if an error occurs before the block completes' do
|
166
|
-
expect {
|
167
|
-
RSpec::Mocks.with_temporary_scope do
|
168
|
-
foo = Object.new
|
169
|
-
expect(foo).to receive(:bar)
|
170
|
-
raise "boom"
|
171
|
-
end
|
172
|
-
}.to raise_error("boom") # rather than MockExpectationError
|
173
|
-
end
|
174
|
-
|
175
|
-
def capture_error
|
176
|
-
yield
|
177
|
-
rescue Exception => @error
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
context "when there is a `let` declaration that overrides an argument matcher" do
|
182
|
-
let(:boolean) { :from_let }
|
183
|
-
|
184
|
-
before do
|
185
|
-
expect(RSpec::Mocks::ArgumentMatchers.method_defined?(:boolean)).to be true
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'allows the `let` definition to win' do
|
189
|
-
expect(boolean).to eq(:from_let)
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,121 +0,0 @@
|
|
1
|
-
require 'rspec/support/spec'
|
2
|
-
require 'rspec/mocks/ruby_features'
|
3
|
-
|
4
|
-
RSpec::Support::Spec.setup_simplecov do
|
5
|
-
minimum_coverage 96
|
6
|
-
end
|
7
|
-
|
8
|
-
require 'yaml'
|
9
|
-
begin
|
10
|
-
require 'psych'
|
11
|
-
rescue LoadError
|
12
|
-
end
|
13
|
-
|
14
|
-
RSpec::Matchers.define :include_method do |expected|
|
15
|
-
match do |actual|
|
16
|
-
actual.map { |m| m.to_s }.include?(expected.to_s)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
module VerifyAndResetHelpers
|
21
|
-
def verify(object)
|
22
|
-
proxy = RSpec::Mocks.space.proxy_for(object)
|
23
|
-
proxy.verify
|
24
|
-
ensure
|
25
|
-
proxy.reset # so it doesn't fail the verify after the example completes
|
26
|
-
end
|
27
|
-
|
28
|
-
def reset(object)
|
29
|
-
RSpec::Mocks.space.proxy_for(object).reset
|
30
|
-
end
|
31
|
-
|
32
|
-
def verify_all
|
33
|
-
RSpec::Mocks.space.verify_all
|
34
|
-
ensure
|
35
|
-
reset_all
|
36
|
-
end
|
37
|
-
|
38
|
-
def reset_all
|
39
|
-
RSpec::Mocks.space.reset_all
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
module VerificationHelpers
|
44
|
-
def prevents(&block)
|
45
|
-
expect(&block).to \
|
46
|
-
raise_error(RSpec::Mocks::MockExpectationError)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
require 'rspec/support/spec'
|
51
|
-
|
52
|
-
RSpec.configure do |config|
|
53
|
-
config.mock_with :rspec
|
54
|
-
config.color_enabled = true
|
55
|
-
config.order = :random
|
56
|
-
|
57
|
-
config.expect_with :rspec do |expectations|
|
58
|
-
expectations.syntax = :expect
|
59
|
-
end
|
60
|
-
|
61
|
-
# TODO: switch most things to the `expect` syntax (and configure only that here)
|
62
|
-
# but keep a small number of specs that use the old syntax in order to test it
|
63
|
-
# (using the "with syntax" shared context defined below).
|
64
|
-
config.mock_with :rspec do |mocks|
|
65
|
-
mocks.syntax = [:should, :expect]
|
66
|
-
end
|
67
|
-
|
68
|
-
old_verbose = nil
|
69
|
-
config.before(:each, :silence_warnings) do
|
70
|
-
old_verbose = $VERBOSE
|
71
|
-
$VERBOSE = nil
|
72
|
-
end
|
73
|
-
|
74
|
-
config.after(:each, :silence_warnings) do
|
75
|
-
$VERBOSE = old_verbose
|
76
|
-
end
|
77
|
-
|
78
|
-
config.include VerifyAndResetHelpers
|
79
|
-
config.include VerificationHelpers
|
80
|
-
config.extend RSpec::Mocks::RubyFeatures
|
81
|
-
config.include RSpec::Mocks::RubyFeatures
|
82
|
-
end
|
83
|
-
|
84
|
-
shared_context "with syntax" do |syntax|
|
85
|
-
orig_syntax = nil
|
86
|
-
|
87
|
-
before(:all) do
|
88
|
-
orig_syntax = RSpec::Mocks.configuration.syntax
|
89
|
-
RSpec::Mocks.configuration.syntax = syntax
|
90
|
-
end
|
91
|
-
|
92
|
-
after(:all) do
|
93
|
-
RSpec::Mocks.configuration.syntax = orig_syntax
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
|
98
|
-
shared_context "with isolated configuration" do
|
99
|
-
orig_configuration = nil
|
100
|
-
before do
|
101
|
-
orig_configuration = RSpec::Mocks.configuration
|
102
|
-
RSpec::Mocks.instance_variable_set(:@configuration, RSpec::Mocks::Configuration.new)
|
103
|
-
end
|
104
|
-
|
105
|
-
after do
|
106
|
-
RSpec::Mocks.instance_variable_set(:@configuration, orig_configuration)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
shared_context "with the default mocks syntax" do
|
111
|
-
orig_syntax = nil
|
112
|
-
|
113
|
-
before(:all) do
|
114
|
-
orig_syntax = RSpec::Mocks.configuration.syntax
|
115
|
-
RSpec::Mocks.configuration.reset_syntaxes_to_default
|
116
|
-
end
|
117
|
-
|
118
|
-
after(:all) do
|
119
|
-
RSpec::Mocks.configuration.syntax = orig_syntax
|
120
|
-
end
|
121
|
-
end
|