defmodule TwittertexTest do use ExUnit.Case doctest Twittertex defp tweet_json(name) do contents = File.read!(Path.join(["test", "tweets", "#{name}.json"])) Poison.Parser.parse!(contents) end test "URLs and hashtags" do json = tweet_json("display_guidelines") assert Twittertex.format_tweet(json) == "Along with our new #Twitterbird, we've also updated our Display Guidelines: dev.twitter.com/terms/display-… ^JC" end test "photo and hashtags" do json = tweet_json("piglets") assert Twittertex.format_tweet(json) == "Just piggin lovely.
#smithillsfarm #kunekune #piglets #cuddling pic.twitter.com/mPMZlracLP" end test "mentions" do json = tweet_json("kanye") assert Twittertex.format_tweet(json) == "Hi @jack Dorsey, can you guys please take down all the fake Kanye accounts." end end