     assert html_response(conn, 200) =~ "Edit task"
   end
 
-  test "does not renders form for editing non existing task", %{conn: conn} do
+  test "does not renders form for editing for non-existing task", %{conn: conn} do
     conn = get conn, task_path(conn, :edit, -1)
     assert html_response(conn, 404)
+  end
+
+  test "does not renders form for editing for non-coordinator users", %{conn: _conn} do
+    student_conn = login_as(:student)
+    teacher_conn = login_as(:teacher)
+    volunteer_conn = login_as(:volunteer)
+
+    task = Repo.insert! %Task{}
+
+    conn = get student_conn, task_path(student_conn, :edit, task)
+    assert html_response(conn, 403)
+
+    conn = get teacher_conn, task_path(teacher_conn, :edit, task)
+    assert html_response(conn, 403)
+
+    conn = get volunteer_conn, task_path(volunteer_conn, :edit, task)
+    assert html_response(conn, 403)
   end
 
   test "updates chosen resource and redirects when data is valid", %{conn: conn} do

    task = Repo.insert! %Task{}
    conn = get conn, task_path(conn, :show, task)
    assert html_response(conn, 200) =~ "Show task"
  end

  test "renders page not found when id is nonexistent", %{conn: conn} do

    assert html_response(conn, 404)
  end

  test "does not update a chosen resource for non-coordinator users", %{conn: _conn} do
    student_conn = login_as(:student)
    teacher_conn = login_as(:teacher)
    volunteer_conn = login_as(:volunteer)

    task = Repo.insert! %Task{}

    conn = put student_conn, task_path(student_conn, :update, task), task: @valid_attrs
    assert html_response(conn, 403)

    conn = put teacher_conn, task_path(teacher_conn, :update, task), task: @valid_attrs
    assert html_response(conn, 403)

    conn = put volunteer_conn, task_path(volunteer_conn, :update, task), task: @valid_attrs
    assert html_response(conn, 403)
  end

  test "deletes chosen resource", %{conn: conn} do
    {:ok, task} = Tasks.new(@valid_attrs)
    conn = delete conn, task_path(conn, :delete, task)
