spec/grape_entity/entity_spec.rb in grape-entity-0.10.1 vs spec/grape_entity/entity_spec.rb in grape-entity-0.10.2
- old
+ new
@@ -387,10 +387,14 @@
describe 'blocks' do
class SomeObject
def method_without_args
'result'
end
+
+ def raises_argument_error
+ raise ArgumentError, 'something different'
+ end
end
describe 'with block passed in' do
specify do
subject.expose :that_method_without_args do |object|
@@ -399,9 +403,20 @@
object = SomeObject.new
value = subject.represent(object).value_for(:that_method_without_args)
expect(value).to eq('result')
+ end
+
+ it 'does not suppress ArgumentError' do
+ subject.expose :raises_argument_error do |object|
+ object.raises_argument_error
+ end
+
+ object = SomeObject.new
+ expect do
+ subject.represent(object).value_for(:raises_argument_error)
+ end.to raise_error(ArgumentError, 'something different')
end
end
context 'with block passed in via &' do
if RUBY_VERSION.start_with?('3')