Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 55843a2

Browse files
committed
Merge pull request #1576 from rspec/prevent_1569_on_master
Prevent doubles causing issues with inline subject.
2 parents 1c2ef7a + f3b0b00 commit 55843a2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

spec/rspec/core/memoized_helpers_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,18 @@ def subject_value_for(describe_arg, &block)
8080
expect(example_yielded_to_subject).to eq example_yielded_to_example
8181
end
8282

83+
context "doesn't issue a deprecation when used with doubles" do
84+
subject do
85+
Struct.new(:value) do
86+
def working_with?(double)
87+
double.value >= value
88+
end
89+
end.new 1
90+
end
91+
92+
it { should be_working_with double(:value => 10) }
93+
end
94+
8395
[false, nil].each do |falsy_value|
8496
context "with a value of #{falsy_value.inspect}" do
8597
it "is evaluated once per example" do

spec/spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ def without_env_vars(*vars)
134134
end
135135

136136
# runtime options
137+
c.raise_errors_for_deprecations!
137138
c.color = true
138139
c.include EnvHelpers
139140
c.filter_run_excluding :ruby => lambda {|version|

0 commit comments

Comments
 (0)