Fix specs to fit Rails updates.

Some SQL statements have been changed by latest version of Rails.