def info(text) do
text = String.replace(text, ~r/[\t\n]/, "")
+
String.split(text, "\r")
- |> Enum.map(fn (text) ->
+ |> Enum.map(fn text ->
"i#{text}\tfake\(NULL)\t0\r\n"
end)
|> Enum.join("")
link("Post ##{activity.id} by #{user.nickname}", "/notices/#{activity.id}") <>
info("#{like_count} likes, #{announcement_count} repeats") <>
- "\r\n" <> info(HtmlSanitizeEx.strip_tags(String.replace(activity.data["object"]["content"], "<br>", "\r")))
+ "\r\n" <>
+ info(
+ HtmlSanitizeEx.strip_tags(
+ String.replace(activity.data["object"]["content"], "<br>", "\r")
+ )
+ )
end)
|> Enum.join("\r\n")
end
|> assign(:user, user)
|> get("/api/statuses/followers")
- assert json_response(conn, 200) ==
- UserView.render("index.json", %{users: [follower_one, follower_two], for: user})
+ expected = UserView.render("index.json", %{users: [follower_one, follower_two], for: user})
+ result = json_response(conn, 200)
+ assert Enum.sort(expected) == Enum.sort(result)
end
end
|> assign(:user, user)
|> get("/api/statuses/friends")
- assert MapSet.equal?(
- MapSet.new(json_response(conn, 200)),
- MapSet.new(
- UserView.render("index.json", %{users: [followed_one, followed_two], for: user})
- )
- )
+ expected = UserView.render("index.json", %{users: [followed_one, followed_two], for: user})
+ result = json_response(conn, 200)
+ assert Enum.sort(expected) == Enum.sort(result)
end
test "it returns a given user's friends with user_id", %{conn: conn} do