-
-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #402 from rspec/prevent_errors_on_stub_removal
Prevent errors on stub removal
- Loading branch information
Showing
11 changed files
with
100 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'spec_helper' | ||
|
||
module RSpec::Mocks | ||
describe Space do | ||
|
||
describe "#proxies_of(klass)" do | ||
let(:space) { Space.new } | ||
|
||
it 'returns proxies' do | ||
space.proxy_for("") | ||
expect(space.proxies_of(String).map(&:class)).to eq([PartialMockProxy]) | ||
end | ||
|
||
it 'returns only the proxies whose object is an instance of the given class' do | ||
grandparent_class = Class.new | ||
parent_class = Class.new(grandparent_class) | ||
child_class = Class.new(parent_class) | ||
|
||
grandparent = grandparent_class.new | ||
parent = parent_class.new | ||
child = child_class.new | ||
|
||
grandparent_proxy = space.proxy_for(grandparent) | ||
parent_proxy = space.proxy_for(parent) | ||
child_proxy = space.proxy_for(child) | ||
|
||
expect(space.proxies_of(parent_class)).to match_array([parent_proxy, child_proxy]) | ||
end | ||
end | ||
|
||
end | ||
end |