Update so that tests run with Rails 4
Refactor render code into callable module function