Remove credo and use mix format, and lint everything

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2018-07-27 10:45:35 +02:00
parent df3f08c528
commit 979aad5acb
104 changed files with 2278 additions and 1487 deletions

View File

@@ -7,7 +7,11 @@ defmodule EventosWeb.BotControllerTest do
alias Eventos.Actors.Bot
@create_attrs %{source: "some source", type: "some type", name: "some name"}
@update_attrs %{source: "some updated source", type: "some updated type", name: "some updated name"}
@update_attrs %{
source: "some updated source",
type: "some updated type",
name: "some updated name"
}
@invalid_attrs %{source: nil, type: nil, name: nil}
setup %{conn: conn} do
@@ -18,7 +22,7 @@ defmodule EventosWeb.BotControllerTest do
describe "index" do
test "lists all bots", %{conn: conn} do
conn = get conn, bot_path(conn, :index)
conn = get(conn, bot_path(conn, :index))
assert json_response(conn, 200)["data"] == []
end
end
@@ -26,19 +30,21 @@ defmodule EventosWeb.BotControllerTest do
describe "create bot" do
test "renders bot when data is valid", %{conn: conn, user: user} do
conn = auth_conn(conn, user)
conn = post conn, bot_path(conn, :create), bot: @create_attrs
conn = post(conn, bot_path(conn, :create), bot: @create_attrs)
assert %{"id" => id} = json_response(conn, 201)["data"]
conn = get conn, bot_path(conn, :show, id)
conn = get(conn, bot_path(conn, :show, id))
assert json_response(conn, 200)["data"] == %{
"id" => id,
"source" => "some source",
"type" => "some type"}
"id" => id,
"source" => "some source",
"type" => "some type"
}
end
test "renders errors when data is invalid", %{conn: conn, user: user} do
conn = auth_conn(conn, user)
conn = post conn, bot_path(conn, :create), bot: @invalid_attrs
conn = post(conn, bot_path(conn, :create), bot: @invalid_attrs)
assert json_response(conn, 422)["errors"] != %{}
end
end
@@ -48,19 +54,21 @@ defmodule EventosWeb.BotControllerTest do
test "renders bot when data is valid", %{conn: conn, bot: %Bot{id: id} = bot, user: user} do
conn = auth_conn(conn, user)
conn = put conn, bot_path(conn, :update, bot), bot: @update_attrs
conn = put(conn, bot_path(conn, :update, bot), bot: @update_attrs)
assert %{"id" => ^id} = json_response(conn, 200)["data"]
conn = get conn, bot_path(conn, :show, id)
conn = get(conn, bot_path(conn, :show, id))
assert json_response(conn, 200)["data"] == %{
"id" => id,
"source" => "some updated source",
"type" => "some updated type"}
"id" => id,
"source" => "some updated source",
"type" => "some updated type"
}
end
test "renders errors when data is invalid", %{conn: conn, bot: bot, user: user} do
conn = auth_conn(conn, user)
conn = put conn, bot_path(conn, :update, bot), bot: @invalid_attrs
conn = put(conn, bot_path(conn, :update, bot), bot: @invalid_attrs)
assert json_response(conn, 422)["errors"] != %{}
end
end
@@ -70,11 +78,12 @@ defmodule EventosWeb.BotControllerTest do
test "deletes chosen bot", %{conn: conn, bot: bot, user: user} do
conn = auth_conn(conn, user)
conn = delete conn, bot_path(conn, :delete, bot)
conn = delete(conn, bot_path(conn, :delete, bot))
assert response(conn, 204)
assert_error_sent 404, fn ->
get conn, bot_path(conn, :show, bot)
end
assert_error_sent(404, fn ->
get(conn, bot_path(conn, :show, bot))
end)
end
end