zendesk/samson — pull request #16 by voanhduy1512 (2014-05-31 16:37:25+00:00)
Title: fix test fail in postgres

Don't know to keep it as one PR or make it two.
When i use Postgres, this line
```ruby
user = User.where(external_id: hash[:external_id]).first
```
give me error
```bash
User::.create_or_update_from_hash::backfilling external_id#test_0001_should backfill user external_id:
ActiveRecord::StatementInvalid: PG::Error: ERROR: operator does not exist: character varying = integer
LINE 1: ...s"."deleted_at" IS NULL AND "users"."external_id" = 9 ORDER...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
: SELECT "users".* FROM "users" WHERE "users"."deleted_at" IS NULL AND "users"."external_id" = 9 ORDER BY "users"."id" ASC LIMIT 1
app/models/user.rb:20:in `create_or_update_from_hash'
test/models/user_test.rb:30:in `block (3 levels) in '
test/models/user_test.rb:68:in `block (4 levels) in '
```
In short, it can't compare string and integer. So i made hash[:external_id] to string before compare. Then another problem appear. `external_id` in `User` model is unique. But in `user_test` `with a new user`, auth_hash doesn't have `external_id` # => nil. And that is `super_admin` `external_id`.