Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix usage of mocks across scopes. #1270

Closed
wants to merge 1 commit into from

2 participants

@xaviershay
Collaborator

These specs were previously infinitely recursing due to a recent
deprecation added to this behaviour.

Speculative fix for #1269, this might not be the best way. The base formatter allows didn't appear to do anything, and I confirmed the configuration spec change fails if a deprecation is received.

@xaviershay xaviershay Fix usage of mocks across scopes.
These specs were previously infinitely recursing due to a recent
deprecation added to this behaviour.
66dc833
@xaviershay
Collaborator

Potentially related: this same change is causing non-breaking deprecation warnings elsewhere. Do we care about deprecations in 2.99 or are they expected?

@myronmarston

Hmm, it's not clear to me what exactly is going on here. The fact there was infinite recursion before suggests that there may be an rspec-mocks problem that these changes hide, and I'm concerned end users may get the infinite recursions. Or is it due to the fact that we do non-standard stuff since we're dog fooding?

Regardless, I'd like to understand this better before merging and checking out this branch and trying it locally will be the best way to do that. I'll make a point to look into this tomorrow (heading to bed now).

Potentially related: this same change is causing non-breaking deprecation warnings elsewhere. Do we care about deprecations in 2.99 or are they expected?

They tend to happen when we add new deprecation warnings. I find them noisy/annoying and tend to either stop using the deprecated feature or use allow_depecation or whatever.

@myronmarston myronmarston deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 27, 2014
  1. @xaviershay

    Fix usage of mocks across scopes.

    xaviershay authored
    These specs were previously infinitely recursing due to a recent
    deprecation added to this behaviour.
This page is out of date. Refresh to see the latest.
View
11 spec/rspec/core/configuration_spec.rb
@@ -1842,13 +1842,16 @@ def metadata_hash(*args)
[:example, :running_example].each do |name|
it "silences the deprecation warning for ##{name} when configured to expose via that name" do
RSpec.configuration.expose_current_running_example_as name
- allow(RSpec).to receive(:deprecate)
- ExampleGroup.describe "Group" do
- specify { __send__(name) }
+ result = ExampleGroup.describe "Group" do
+ specify {
+ allow(RSpec).to receive(:deprecate)
+ __send__(name)
+ expect(RSpec).to_not have_received(:deprecate)
+ }
end.run
- expect(RSpec).to_not have_received(:deprecate)
+ expect(result).to eq(true)
end
end
end
View
5 spec/rspec/core/formatters/base_text_formatter_spec.rb
@@ -147,8 +147,6 @@ def run_all_and_dump_failures
end
context 'for #share_as' do
- before { allow(RSpec).to receive(:deprecate) }
-
it 'outputs the name and location' do
group.share_as :FooBar do
@@ -286,8 +284,6 @@ def run_all_and_dump_pending
end
context 'for #share_as' do
- before { allow(RSpec).to receive(:deprecate) }
-
it 'outputs the name and location' do
group.share_as :FooBar2 do
@@ -475,7 +471,6 @@ def run_all_and_dump_pending
describe "##{name}" do
before do
allow(RSpec.configuration).to receive(:color_enabled?) { true }
- allow(RSpec).to receive(:deprecate)
end
it "prints the text using the color code for #{name}" do
Something went wrong with that request. Please try again.