From ada01d826f0f863997d5a96d922e287e3fd81b33 Mon Sep 17 00:00:00 2001 From: hans Date: Mon, 17 Jul 2017 12:00:08 +0200 Subject: [PATCH] fix emoji --- .../20170717094445_update_posting_text.exs | 10 ++++++++++ test/controllers/posting_controller_test.exs | 12 ++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 priv/repo/migrations/20170717094445_update_posting_text.exs diff --git a/priv/repo/migrations/20170717094445_update_posting_text.exs b/priv/repo/migrations/20170717094445_update_posting_text.exs new file mode 100644 index 0000000..d91d2f1 --- /dev/null +++ b/priv/repo/migrations/20170717094445_update_posting_text.exs @@ -0,0 +1,10 @@ +defmodule ElixirStatus.Repo.Migrations.UpdatePostingText do + use Ecto.Migration + + def change do + alter table(:postings) do + modify :text, :"TEXT CHARACTER SET utf8mb4" + modify :title, :"TEXT CHARACTER SET utf8mb4" + end + end +end diff --git a/test/controllers/posting_controller_test.exs b/test/controllers/posting_controller_test.exs index 9e2f430..129b19d 100644 --- a/test/controllers/posting_controller_test.exs +++ b/test/controllers/posting_controller_test.exs @@ -42,6 +42,18 @@ defmodule ElixirStatus.PostingControllerTest do assert redirected_to(conn) == posting_path(conn, :index) end + @tag posting_create: true + test "creates resource and redirects when data is includes emojies", _ do + attrs_with_emoji = %{text: "🗜🐳📦 some [content](http://github.com/) on the [web](http://google.com/)", title: "🗜🐳📦 some content"} + conn = logged_in_conn() + conn = + conn + |> post(posting_path(conn, :create), posting: attrs_with_emoji) + + assert Repo.get_by(Posting, attrs_with_emoji) + assert redirected_to(conn) == posting_path(conn, :index) + end + @tag posting_create: true test "when NOT logged in -> does not create resource and renders errors when data is invalid", _ do conn = logged_out_conn()