Skip to content

Commit 95ce4be

Browse files
committed
formating
1 parent fc1f52e commit 95ce4be

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

priv/templates/corex.gen.context/test_cases.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import <%= inspect context.module %>Fixtures
66

77
@invalid_attrs %{
8-
<% invalid_keys = schema.params.create %><%= for {{key, _}, idx} <- Enum.with_index(invalid_keys) do %> <%= key %>: nil<%= if idx < length(invalid_keys) - 1 do %>,<% end %>
8+
<% invalid_keys = schema.params.create %><%= for {{key, _}, idx} <- Enum.with_index(invalid_keys) do %> <%= key %>: nil<%= if idx < Enum.count(invalid_keys) - 1 do %>,<% end %>
99
<% end %> }
1010

1111
test "list_<%= schema.plural %>/0 returns all <%= schema.plural %>" do
@@ -20,7 +20,7 @@
2020

2121
test "create_<%= schema.singular %>/1 with valid data creates a <%= schema.singular %>" do
2222
valid_attrs = %{
23-
<% create_params = schema.params.create %><%= for {{field, value}, idx} <- Enum.with_index(create_params) do %> <%= field %>: <%= Mix.Phoenix.Schema.value(schema, field, value) %><%= if idx < length(create_params) - 1 do %>,<% end %>
23+
<% create_params = schema.params.create %><%= for {{field, value}, idx} <- Enum.with_index(create_params) do %> <%= field %>: <%= Mix.Phoenix.Schema.value(schema, field, value) %><%= if idx < Enum.count(create_params) - 1 do %>,<% end %>
2424
<% end %> }
2525

2626
assert {:ok, %<%= inspect schema.alias %>{} = <%= schema.singular %>} = <%= inspect context.alias %>.create_<%= schema.singular %>(valid_attrs)<%= for {field, value} <- schema.params.create do %>
@@ -35,7 +35,7 @@
3535
<%= schema.singular %> = <%= schema.singular %>_fixture()
3636

3737
update_attrs = %{
38-
<% update_params = schema.params.update %><%= for {{field, value}, idx} <- Enum.with_index(update_params) do %> <%= field %>: <%= Mix.Phoenix.Schema.value(schema, field, value) %><%= if idx < length(update_params) - 1 do %>,<% end %>
38+
<% update_params = schema.params.update %><%= for {{field, value}, idx} <- Enum.with_index(update_params) do %> <%= field %>: <%= Mix.Phoenix.Schema.value(schema, field, value) %><%= if idx < Enum.count(update_params) - 1 do %>,<% end %>
3939
<% end %> }
4040

4141
assert {:ok, %<%= inspect schema.alias %>{} = <%= schema.singular %>} = <%= inspect context.alias %>.update_<%= schema.singular %>(<%= schema.singular %>, update_attrs)<%= for {field, value} <- schema.params.update do %>

priv/templates/corex.gen.context/test_cases_scope.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import <%= inspect context.module %>Fixtures
77

88
@invalid_attrs %{
9-
<% invalid_keys_scoped = schema.params.create %><%= for {{key, _}, idx} <- Enum.with_index(invalid_keys_scoped) do %> <%= key %>: nil<%= if idx < length(invalid_keys_scoped) - 1 do %>,<% end %>
9+
<% invalid_keys_scoped = schema.params.create %><%= for {{key, _}, idx} <- Enum.with_index(invalid_keys_scoped) do %> <%= key %>: nil<%= if idx < Enum.count(invalid_keys_scoped) - 1 do %>,<% end %>
1010
<% end %> }
1111

1212
test "list_<%= schema.plural %>/1 returns all scoped <%= schema.plural %>" do
@@ -28,7 +28,7 @@
2828

2929
test "create_<%= schema.singular %>/2 with valid data creates a <%= schema.singular %>" do
3030
valid_attrs = %{
31-
<% create_params_scoped = schema.params.create %><%= for {{field, value}, idx} <- Enum.with_index(create_params_scoped) do %> <%= field %>: <%= Mix.Phoenix.Schema.value(schema, field, value) %><%= if idx < length(create_params_scoped) - 1 do %>,<% end %>
31+
<% create_params_scoped = schema.params.create %><%= for {{field, value}, idx} <- Enum.with_index(create_params_scoped) do %> <%= field %>: <%= Mix.Phoenix.Schema.value(schema, field, value) %><%= if idx < Enum.count(create_params_scoped) - 1 do %>,<% end %>
3232
<% end %> }
3333
scope = <%= scope.name %>_scope_fixture()
3434

@@ -47,7 +47,7 @@
4747
<%= schema.singular %> = <%= schema.singular %>_fixture(scope)
4848

4949
update_attrs = %{
50-
<% update_params_scoped = schema.params.update %><%= for {{field, value}, idx} <- Enum.with_index(update_params_scoped) do %> <%= field %>: <%= Mix.Phoenix.Schema.value(schema, field, value) %><%= if idx < length(update_params_scoped) - 1 do %>,<% end %>
50+
<% update_params_scoped = schema.params.update %><%= for {{field, value}, idx} <- Enum.with_index(update_params_scoped) do %> <%= field %>: <%= Mix.Phoenix.Schema.value(schema, field, value) %><%= if idx < Enum.count(update_params_scoped) - 1 do %>,<% end %>
5151
<% end %> }
5252

5353
assert {:ok, %<%= inspect schema.alias %>{} = <%= schema.singular %>} = <%= inspect context.alias %>.update_<%= schema.singular %>(scope, <%= schema.singular %>, update_attrs)<%= for {field, value} <- schema.params.update do %>

priv/templates/corex.gen.html/controller_test.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
44
import <%= inspect context.module %>Fixtures
55

66
@create_attrs %{
7-
<% params_create = schema.params.create %><%= for {{key, value}, idx} <- Enum.with_index(params_create) do %> <%= key %>: <%= Mix.Phoenix.Schema.value(schema, key, value) %><%= if idx < length(params_create) - 1 do %>,<% end %>
7+
<% params_create = schema.params.create %><%= for {{key, value}, idx} <- Enum.with_index(params_create) do %> <%= key %>: <%= Mix.Phoenix.Schema.value(schema, key, value) %><%= if idx < Enum.count(params_create) - 1 do %>,<% end %>
88
<% end %> }
99
@update_attrs %{
10-
<% params_update = schema.params.update %><%= for {{key, value}, idx} <- Enum.with_index(params_update) do %> <%= key %>: <%= Mix.Phoenix.Schema.value(schema, key, value) %><%= if idx < length(params_update) - 1 do %>,<% end %>
10+
<% params_update = schema.params.update %><%= for {{key, value}, idx} <- Enum.with_index(params_update) do %> <%= key %>: <%= Mix.Phoenix.Schema.value(schema, key, value) %><%= if idx < Enum.count(params_update) - 1 do %>,<% end %>
1111
<% end %> }
1212
@invalid_attrs %{
13-
<% params_create_inv = schema.params.create %><%= for {{key, _}, idx} <- Enum.with_index(params_create_inv) do %> <%= key %>: nil<%= if idx < length(params_create_inv) - 1 do %>,<% end %>
13+
<% params_create_inv = schema.params.create %><%= for {{key, _}, idx} <- Enum.with_index(params_create_inv) do %> <%= key %>: nil<%= if idx < Enum.count(params_create_inv) - 1 do %>,<% end %>
1414
<% end %> }<%= if layout_locale do %>
1515

1616
@locale Application.compile_env(:<%= context.context_app %>, :locales, ["en"]) |> List.first()<% end %><%= if scope do %>

priv/templates/corex.gen.schema/schema.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ defmodule <%= inspect schema.module %> do
1919
def changeset(<%= schema.singular %>, attrs<%= if scope do %>, <%= scope.name %>_scope<% end %>) do
2020
<%= schema.singular %>
2121
|> cast(attrs, [
22-
<% attrs_list = schema.attrs %><%= for {{attr, _}, idx} <- Enum.with_index(attrs_list) do %> <%= inspect attr %><%= if idx < length(attrs_list) - 1 do %>,<% end %>
22+
<% attrs_list = schema.attrs %><%= for {{attr, _}, idx} <- Enum.with_index(attrs_list) do %> <%= inspect attr %><%= if idx < Enum.count(attrs_list) - 1 do %>,<% end %>
2323
<% end %> ])
2424
|> validate_required([
25-
<% required_list = Mix.Phoenix.Schema.required_fields(schema) %><%= for {{attr, _}, idx} <- Enum.with_index(required_list) do %> <%= inspect attr %><%= if idx < length(required_list) - 1 do %>,<% end %>
25+
<% required_list = Mix.Phoenix.Schema.required_fields(schema) %><%= for {{attr, _}, idx} <- Enum.with_index(required_list) do %> <%= inspect attr %><%= if idx < Enum.count(required_list) - 1 do %>,<% end %>
2626
<% end %> ])
2727
<%= for k <- schema.uniques do %> |> unique_constraint(<%= inspect k %>)
2828
<% end %><%= if scope do %> |> put_change(:<%= scope.schema_key %>, <%= scope.name %>_scope.<%= Enum.join(scope.access_path, ".") %>)

0 commit comments

Comments
 (0)