Add tests (and fix a bug) for new render_metadata! method