mirror of
https://github.com/meineerde/rackstash.git
synced 2025-10-17 14:01:01 +00:00
Clarify the error message when trying to fetch invalid specs from a ClassRegistry
This commit is contained in:
parent
2d04ccb6c9
commit
42d120561b
@ -62,7 +62,8 @@ module Rackstash
|
||||
raise KeyError, "No #{@object_type} was registered for #{spec.inspect}"
|
||||
end
|
||||
else
|
||||
raise TypeError, "#{spec.inspect} can not be used to describe #{@object_type}s"
|
||||
raise TypeError, "#{spec.inspect} can not be used to describe " \
|
||||
"#{@object_type} classes"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -80,11 +80,11 @@ describe Rackstash::ClassRegistry do
|
||||
|
||||
it 'raises a TypeError on invalid names' do
|
||||
expect { registry.fetch(0) }
|
||||
.to raise_error(TypeError, '0 can not be used to describe values')
|
||||
.to raise_error(TypeError, '0 can not be used to describe value classes')
|
||||
expect { registry.fetch(nil) }
|
||||
.to raise_error(TypeError, 'nil can not be used to describe values')
|
||||
.to raise_error(TypeError, 'nil can not be used to describe value classes')
|
||||
expect { registry.fetch(true) }
|
||||
.to raise_error(TypeError, 'true can not be used to describe values')
|
||||
.to raise_error(TypeError, 'true can not be used to describe value classes')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -62,11 +62,11 @@ describe Rackstash::Encoder do
|
||||
|
||||
it 'raises a TypeError with invalid spec types' do
|
||||
expect { described_class.build(123) }
|
||||
.to raise_error(TypeError, '123 can not be used to describe encoders')
|
||||
.to raise_error(TypeError, '123 can not be used to describe encoder classes')
|
||||
expect { described_class.build(nil) }
|
||||
.to raise_error(TypeError, 'nil can not be used to describe encoders')
|
||||
.to raise_error(TypeError, 'nil can not be used to describe encoder classes')
|
||||
expect { described_class.build(true) }
|
||||
.to raise_error(TypeError, 'true can not be used to describe encoders')
|
||||
.to raise_error(TypeError, 'true can not be used to describe encoder classes')
|
||||
end
|
||||
|
||||
it 'raises a KeyError for undefined encoders' do
|
||||
|
||||
@ -135,11 +135,11 @@ describe Rackstash::Filter do
|
||||
|
||||
it 'raises a TypeError with invalid spec types' do
|
||||
expect { described_class.build(123) }
|
||||
.to raise_error(TypeError, '123 can not be used to describe filters')
|
||||
.to raise_error(TypeError, '123 can not be used to describe filter classes')
|
||||
expect { described_class.build(nil) }
|
||||
.to raise_error(TypeError, 'nil can not be used to describe filters')
|
||||
.to raise_error(TypeError, 'nil can not be used to describe filter classes')
|
||||
expect { described_class.build(true) }
|
||||
.to raise_error(TypeError, 'true can not be used to describe filters')
|
||||
.to raise_error(TypeError, 'true can not be used to describe filter classes')
|
||||
end
|
||||
|
||||
it 'raises a KeyError for undefined filters' do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user