Skip to content

Commit

Permalink
Fixing the issue with “and” in the command
Browse files Browse the repository at this point in the history
  • Loading branch information
cdesch committed Mar 9, 2018
1 parent 9824b3d commit 8739c18
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
9 changes: 8 additions & 1 deletion README.md
Expand Up @@ -6,7 +6,7 @@
## Generators

mix phx.gen.html Blog Post posts title:string content:string
mix phx.gen.json Blog Post posts title:string content:string --web Api --no-context and --no-schema
mix phx.gen.json Blog Post posts title:string content:string --web Api --no-context --no-schema

### Other modifications

Expand All @@ -28,6 +28,13 @@ Modified for the correct route paths:
resources "/posts", PostController
end

Initally, for the project, we used the following command with `and`:

mix phx.gen.json Blog Post posts title:string content:string --web Api --no-context and --no-schema

This should have been removed and caused some issues with our `PhxGenHtmlJsonWeb.Api.PostControllerTest` test cases. This change reflects what was needed to fix those.


## Starting

To start your Phoenix server:
Expand Down
3 changes: 1 addition & 2 deletions lib/phx_gen_html_json_web/views/api/post_view.ex
Expand Up @@ -13,7 +13,6 @@ defmodule PhxGenHtmlJsonWeb.Api.PostView do
def render("post.json", %{post: post}) do
%{id: post.id,
title: post.title,
content: post.content,
and: post.and}
content: post.content}
end
end
Expand Up @@ -4,9 +4,9 @@ defmodule PhxGenHtmlJsonWeb.Api.PostControllerTest do
alias PhxGenHtmlJson.Blog
alias PhxGenHtmlJson.Blog.Post

@create_attrs %{and: "some and", content: "some content", title: "some title"}
@update_attrs %{and: "some updated and", content: "some updated content", title: "some updated title"}
@invalid_attrs %{and: nil, content: nil, title: nil}
@create_attrs %{content: "some content", title: "some title"}
@update_attrs %{content: "some updated content", title: "some updated title"}
@invalid_attrs %{content: nil, title: nil}

def fixture(:post) do
{:ok, post} = Blog.create_post(@create_attrs)
Expand All @@ -32,7 +32,6 @@ defmodule PhxGenHtmlJsonWeb.Api.PostControllerTest do
conn = get conn, api_post_path(conn, :show, id)
assert json_response(conn, 200)["data"] == %{
"id" => id,
"and" => "some and",
"content" => "some content",
"title" => "some title"}
end
Expand All @@ -53,7 +52,6 @@ defmodule PhxGenHtmlJsonWeb.Api.PostControllerTest do
conn = get conn, api_post_path(conn, :show, id)
assert json_response(conn, 200)["data"] == %{
"id" => id,
"and" => "some updated and",
"content" => "some updated content",
"title" => "some updated title"}
end
Expand Down

0 comments on commit 8739c18

Please sign in to comment.