Fixed problem with Rails engines and added a spec