Use first_or_create instead of raw SQL.
Use a proper HTML parser in tests so we don't depend on ordering, newlines, etc.
Fix more tests that fail due to slightly different ordering in JRuby.