Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/rspec/mocks/error_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ module Mocks
# @private
NegationUnsupportedError = Class.new(StandardError)

VerifyingDoubleNotDefinedError = Class.new(StandardError)

# @private
class ErrorGenerator
attr_writer :opts
Expand Down
4 changes: 2 additions & 2 deletions lib/rspec/mocks/example_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ def self.declare_verifying_double(type, ref, *args)
if RSpec::Mocks.configuration.verify_doubled_constant_names? &&
!ref.defined?

raise NameError,
"#{ref.name} is not a defined constant. " +
raise VerifyingDoubleNotDefinedError,
"#{ref.description} is not a defined constant. " +
"Perhaps you misspelt it? " +
"Disable check with verify_doubled_constant_names configuration option."
end
Expand Down
4 changes: 2 additions & 2 deletions spec/rspec/mocks/verifying_double_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -535,13 +535,13 @@ module Mocks
it 'prevents creation of instance doubles for unloaded constants' do
expect {
instance_double('LoadedClas')
}.to raise_error(NameError)
}.to raise_error(VerifyingDoubleNotDefinedError)
end

it 'prevents creation of class doubles for unloaded constants' do
expect {
class_double('LoadedClas')
}.to raise_error(NameError)
}.to raise_error(VerifyingDoubleNotDefinedError)
end
end

Expand Down