Repository: phoenixframework/phoenix
Pull request #4587 (2021-11-09 19:25:45)

Update contexts.md
Small typo fix


Patch:
diff --git a/README.md b/README.md
index 0f6474593..ea76288d7 100644
--- a/README.md
+++ b/README.md
@@ -68,7 +68,6 @@ $ mix archive.build
 ```bash
 $ cd assets
 $ npm install
-$ npm run watch
 ```
 
 ## Important links
diff --git a/guides/contexts.md b/guides/contexts.md
index 792e14e15..055b9592b 100644
--- a/guides/contexts.md
+++ b/guides/contexts.md
@@ -22,7 +22,7 @@ In Phoenix, contexts often encapsulate data access and data validation. They oft
 
 ### Adding a Catalog Context
 
-An ecommerce platform has wide-reaching coupling across a codebase so it's important to think upfront about writing well-defined interfaces. With that in mind, our goal is to build a product catalog API that handles creating, updating, and deleting the products available in our system. We'll start off with the basic features of showcasing our products, but as we add cart features later. We'll see how starting with a solid foundation with isolated boundaries allows us to grow our application naturally as we add functionality.
+An ecommerce platform has wide-reaching coupling across a codebase so it's important to think upfront about writing well-defined interfaces. With that in mind, our goal is to build a product catalog API that handles creating, updating, and deleting the products available in our system. We'll start off with the basic features of showcasing our products, and we will add shopping cart features later. We'll see how starting with a solid foundation with isolated boundaries allows us to grow our application naturally as we add functionality.
 
 Phoenix includes the `mix phx.gen.html`, `mix phx.gen.json`, `mix phx.gen.live`, and `mix phx.gen.context` generators that apply the ideas of isolating functionality in our applications into contexts. These generators are a great way to hit the ground running while Phoenix nudges you in the right direction to grow your application. Let's put these tools to use for our new product catalog context.
 
@@ -799,7 +799,7 @@ defmodule HelloWeb.CartItemController do
 end
 ```
 
-We defined a new `CartItemController` with the create and delete actions that we declared in our router. For `create`, we first lookup the product in the catalog with `Catalog.get_product!/1`, then we call a `ShoppingCart.add_item_to_cart/2` function which we'll implement in a moment. If successful, we show a flash successful message and redirect to the cart show page; else, we show a flash error message and redirect to the cart show page. For `delete`, we'll call a `remove_item_from_cart` function which we'll implement on our `ShoppingCart` context  and then redirect back to the cart show page. We haven't implemented these two shopping cart functions yet, but notice how their names scream their intent: `add_item_to_cart` and `remove_item_from_cart` make it obvious what we are accomplishing here. It also allows us to spec our our web layer and context APIs without thinking about all the implementation details at once.
+We defined a new `CartItemController` with the create and delete actions that we declared in our router. For `create`, we first lookup the product in the catalog with `Catalog.get_product!/1`, then we call a `ShoppingCart.add_item_to_cart/2` function which we'll implement in a moment. If successful, we show a flash successful message and redirect to the cart show page; else, we show a flash error message and redirect to the cart show page. For `delete`, we'll call a `remove_item_from_cart` function which we'll implement on our `ShoppingCart` context  and then redirect back to the cart show page. We haven't implemented these two shopping cart functions yet, but notice how their names scream their intent: `add_item_to_cart` and `remove_item_from_cart` make it obvious what we are accomplishing here. It also allows us to spec out our web layer and context APIs without thinking about all the implementation details at once.
 
 Let's implement our new interface of `ShoppingCart` context API in `lib/hello/shopping_cart.ex`:
 
diff --git a/guides/deployment/deployment.md b/guides/deployment/deployment.md
index 35f263569..d7bb14ce9 100644
--- a/guides/deployment/deployment.md
+++ b/guides/deployment/deployment.md
@@ -29,7 +29,7 @@ $ export DATABASE_URL=ecto://USER:PASS@HOST/database
 
 Do not copy those values directly, set `SECRET_KEY_BASE` according to the result of `mix phx.gen.secret` and `DATABASE_URL` according to your database address.
 
-If for some reason you do not want to rely on environment variables, you can hard code the secrets in your `config/runtime.exs` (formerly `config/prod.secret.exs` or `config/releases.exs`), but make sure not to check the file into your version control system.
+If for some reason you do not want to rely on environment variables, you can hard code the secrets in your `config/runtime.exs` but make sure not to check the file into your version control system.
 
 With your secret information properly secured, it is time to configure assets!
 
diff --git a/guides/ecto.md b/guides/ecto.md
index e463c4486..5df20fb83 100644
--- a/guides/ecto.md
+++ b/guides/ecto.md
@@ -393,7 +393,7 @@ There are many more validations and transformations we can perform in a changese
 
 ## Data persistence
 
-We've explored migrations and schemas, but we haven't yet persisted any of our schemas or changesets. We briefly looked at our repository module in `lib/hello/repo.ex` earlier, now it's time to put it to use.
+We've explored migrations and schemas, but we haven't yet persisted any of our schemas or changesets. We briefly looked at our repository module in `lib/hello/repo.ex` earlier, and now it's time to put it to use.
 
 Ecto repositories are the interface into a storage system, be it a database like PostgreSQL or an external service like a RESTful API. The `Repo` module's purpose is to take care of the finer details of persistence and data querying for us. As the caller, we only care about fetching and persisting data. The `Repo` module takes care of the underlying database adapter communication, connection pooling, and error translation for database constraint violations.
 
@@ -590,4 +590,4 @@ The data world is your oyster, but we won't be covering these options in these g
 [`Repo.one/2`]: `c:Ecto.Repo.one/2`
 [`Repo.update_all/3`]: `c:Ecto.Repo.update_all/3`
 [`Repo.update/2`]: `c:Ecto.Repo.update/2`
-[`timestamps/1`]: `Ecto.Migration.timestamps/1`
\ No newline at end of file
+[`timestamps/1`]: `Ecto.Migration.timestamps/1`
diff --git a/guides/real_time/channels.md b/guides/real_time/channels.md
index c3d2662a1..c93968a40 100644
--- a/guides/real_time/channels.md
+++ b/guides/real_time/channels.md
@@ -168,7 +168,7 @@ The following libraries exist today, and new ones are always welcome.
 
 #### Official
 
-Phoenix ships with a JavaScript client that is available when generating a new Phoenix project. The documentation for the JavaScript module is available at [https://hexdocs.pm/phoenix/js/](https://hexdocs.pm/phoenix/js/); the code is in [phoenix.js](https://github.com/phoenixframework/phoenix/blob/master/assets/js/phoenix.js).
+Phoenix ships with a JavaScript client that is available when generating a new Phoenix project. The documentation for the JavaScript module is available at [https://hexdocs.pm/phoenix/js/](https://hexdocs.pm/phoenix/js/); the code is in [multiple js files](https://github.com/phoenixframework/phoenix/blob/master/assets/js/phoenix/).
 
 #### 3rd Party
 
diff --git a/priv/templates/phx.gen.channel/channel.ex b/priv/templates/phx.gen.channel/channel.ex
index 4c1cf8215..0f7a9b5e5 100644
--- a/priv/templates/phx.gen.channel/channel.ex
+++ b/priv/templates/phx.gen.channel/channel.ex
@@ -21,7 +21,7 @@ defmodule <%= module %>Channel do
   # broadcast to everyone in the current topic (<%= singular %>:lobby).
   @impl true
   def handle_in("shout", payload, socket) do
-    broadcast socket, "shout", payload
+    broadcast(socket, "shout", payload)
     {:noreply, socket}
   end
 


Test patch:
diff --git a/priv/templates/phx.gen.channel/channel_test.exs b/priv/templates/phx.gen.channel/channel_test.exs
index 6fc15ebde..7698d8700 100644
--- a/priv/templates/phx.gen.channel/channel_test.exs
+++ b/priv/templates/phx.gen.channel/channel_test.exs
@@ -11,17 +11,17 @@ defmodule <%= module %>ChannelTest do
   end
 
   test "ping replies with status ok", %{socket: socket} do
-    ref = push socket, "ping", %{"hello" => "there"}
+    ref = push(socket, "ping", %{"hello" => "there"})
     assert_reply ref, :ok, %{"hello" => "there"}
   end
 
   test "shout broadcasts to <%= singular %>:lobby", %{socket: socket} do
-    push socket, "shout", %{"hello" => "all"}
+    push(socket, "shout", %{"hello" => "all"})
     assert_broadcast "shout", %{"hello" => "all"}
   end
 
   test "broadcasts are pushed to the client", %{socket: socket} do
-    broadcast_from! socket, "broadcast", %{"some" => "data"}
+    broadcast_from!(socket, "broadcast", %{"some" => "data"})
     assert_push "broadcast", %{"some" => "data"}
   end
 end
diff --git a/test/mix/tasks/phx.gen.auth_test.exs b/test/mix/tasks/phx.gen.auth_test.exs
index 962bc4a18..732eb9937 100644
--- a/test/mix/tasks/phx.gen.auth_test.exs
+++ b/test/mix/tasks/phx.gen.auth_test.exs
@@ -545,7 +545,7 @@ defmodule Mix.Tasks.Phx.Gen.AuthTest do
     end
   end
 
-  test "supports --binary_id option", config do
+  test "supports --binary-id option", config do
     in_tmp_phx_project(config.test, fn ->
       Gen.Auth.run(
         ~w(Accounts User users --binary-id),
diff --git a/test/mix/tasks/phx.gen.channel_test.exs b/test/mix/tasks/phx.gen.channel_test.exs
index c21f7c581..fb1fa7365 100644
--- a/test/mix/tasks/phx.gen.channel_test.exs
+++ b/test/mix/tasks/phx.gen.channel_test.exs
@@ -27,7 +27,7 @@ defmodule Mix.Tasks.Phx.Gen.ChannelTest do
         assert file =~ ~S|def handle_in("ping", payload, socket) do|
         assert file =~ ~S|{:reply, {:ok, payload}, socket}|
         assert file =~ ~S|def handle_in("shout", payload, socket) do|
-        assert file =~ ~S|broadcast socket, "shout", payload|
+        assert file =~ ~S|broadcast(socket, "shout", payload)|
         assert file =~ ~S|{:noreply, socket}|
       end)
 
@@ -38,15 +38,15 @@ defmodule Mix.Tasks.Phx.Gen.ChannelTest do
         assert file =~ ~S|> subscribe_and_join(PhoenixWeb.RoomChannel|
 
         assert file =~ ~S|test "ping replies with status ok"|
-        assert file =~ ~S|ref = push socket, "ping", %{"hello" => "there"}|
+        assert file =~ ~S|ref = push(socket, "ping", %{"hello" => "there"})|
         assert file =~ ~S|assert_reply ref, :ok, %{"hello" => "there"}|
 
         assert file =~ ~S|test "shout broadcasts to room:lobby"|
-        assert file =~ ~S|push socket, "shout", %{"hello" => "all"}|
+        assert file =~ ~S|push(socket, "shout", %{"hello" => "all"})|
         assert file =~ ~S|assert_broadcast "shout", %{"hello" => "all"}|
 
         assert file =~ ~S|test "broadcasts are pushed to the client"|
-        assert file =~ ~S|broadcast_from! socket, "broadcast", %{"some" => "data"}|
+        assert file =~ ~S|broadcast_from!(socket, "broadcast", %{"some" => "data"})|
         assert file =~ ~S|assert_push "broadcast", %{"some" => "data"}|
       end)
     end)