Fix functional/tasks_controller_test.rb tests

* replace machinist with factory girl
* try to fix uniq index error in pg env