Skip to content

Commit edb14f9

Browse files
committed
Add failing test
1 parent 079993f commit edb14f9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

spec/grape_entity/entity_spec.rb

+9
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,15 @@ class Parent < Person
272272
expect(subject.represent({ name: 'bar' }, serializable: true)).to eq(email: nil, name: 'bar')
273273
expect(child_class.represent({ name: 'bar' }, serializable: true)).to eq(email: nil, name: 'foo')
274274
end
275+
276+
it 'supports class reopening' do
277+
subject.expose :name
278+
child_class = Class.new(subject)
279+
subject.expose :email
280+
281+
expect(subject.represent({ name: 'bar', email: 'foo@bar' }, serializable: true)).to eq(email: 'foo@bar', name: 'bar')
282+
expect(child_class.represent({ name: 'bar', email: 'foo@bar' }, serializable: true)).to eq(email: 'foo@bar', name: 'foo')
283+
end
275284
end
276285

277286
context 'register formatters' do

0 commit comments

Comments
 (0)