From edb14f90ffcb2fa31a9dc6e11f155a5048d6ca00 Mon Sep 17 00:00:00 2001 From: Vladimir Kochnev Date: Mon, 3 Aug 2015 12:00:32 +0300 Subject: [PATCH] Add failing test --- spec/grape_entity/entity_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) 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