modified to use rails_helper and fixed some tests