     task = Repo.insert! %Task{}
     conn = get conn, task_path(conn, :show, task)
     assert html_response(conn, 200) =~ "Show task"
+  end
+
+  test "does not show chosen resource for student and teacher", %{conn: _conn} do
+    student_conn = login_as(:student)
+    teacher_conn = login_as(:teacher)
+
+    task = Repo.insert! %Task{}
+
+    conn = get student_conn, task_path(student_conn, :show, task)
+    assert html_response(conn, 403)
+
+    conn = get teacher_conn, task_path(teacher_conn, :show, task)
+    assert html_response(conn, 403)
   end
 
   test "renders page not found when id is nonexistent", %{conn: conn} do

    assert html_response(conn, 404)
  end

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

    conn = get conn, task_path(conn, :index)
    assert  html_response(conn, 200) =~ "Task was not found"
  end


end
