diff --git a/spec/grape_entity/entity_spec.rb b/spec/grape_entity/entity_spec.rb index 62a95ef5..8cd3c9c3 100644 --- a/spec/grape_entity/entity_spec.rb +++ b/spec/grape_entity/entity_spec.rb @@ -272,6 +272,15 @@ class Parent < Person expect(subject.represent({ name: 'bar' }, serializable: true)).to eq(email: nil, name: 'bar') expect(child_class.represent({ name: 'bar' }, serializable: true)).to eq(email: nil, name: 'foo') end + + it 'supports class reopening' do + subject.expose :name + child_class = Class.new(subject) + subject.expose :email + + expect(subject.represent({ name: 'bar', email: 'foo@bar' }, serializable: true)).to eq(email: 'foo@bar', name: 'bar') + expect(child_class.represent({ name: 'bar', email: 'foo@bar' }, serializable: true)).to eq(email: 'foo@bar', name: 'foo') + end end context 'register formatters' do