From e0fa2ce9614d4bc28ddc484d5b4fe2f54b402e8a Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sun, 17 Sep 2017 09:29:30 +0900 Subject: Remove frozen_string_literal magic comment from templates Follow up of #30348 --- railties/lib/rails/generators/test_unit/model/templates/unit_test.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'railties/lib/rails/generators/test_unit/model/templates') diff --git a/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb b/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb index 5f1ffeb33b..c9bc7d5b90 100644 --- a/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb +++ b/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - require 'test_helper' <% module_namespacing do -%> -- cgit v1.2.3 From 8dd76a7a6ff1bb7105beabb8f834ca54ab1e5fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 13 Nov 2017 15:23:28 -0500 Subject: Use .tt extension to all the template files Make clear that the files are not to be run for interpreters. Fixes #23847. Fixes #30690. Closes #23878. --- .../test_unit/model/templates/fixtures.yml | 29 ---------------------- .../test_unit/model/templates/fixtures.yml.tt | 29 ++++++++++++++++++++++ .../test_unit/model/templates/unit_test.rb | 9 ------- .../test_unit/model/templates/unit_test.rb.tt | 9 +++++++ 4 files changed, 38 insertions(+), 38 deletions(-) delete mode 100644 railties/lib/rails/generators/test_unit/model/templates/fixtures.yml create mode 100644 railties/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt delete mode 100644 railties/lib/rails/generators/test_unit/model/templates/unit_test.rb create mode 100644 railties/lib/rails/generators/test_unit/model/templates/unit_test.rb.tt (limited to 'railties/lib/rails/generators/test_unit/model/templates') diff --git a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml deleted file mode 100644 index 0681780c97..0000000000 --- a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml +++ /dev/null @@ -1,29 +0,0 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html -<% unless attributes.empty? -%> -<% %w(one two).each do |name| %> -<%= name %>: -<% attributes.each do |attribute| -%> - <%- if attribute.password_digest? -%> - password_digest: <%%= BCrypt::Password.create('secret') %> - <%- elsif attribute.reference? -%> - <%= yaml_key_value(attribute.column_name.sub(/_id$/, ''), attribute.default || name) %> - <%- else -%> - <%= yaml_key_value(attribute.column_name, attribute.default) %> - <%- end -%> - <%- if attribute.polymorphic? -%> - <%= yaml_key_value("#{attribute.name}_type", attribute.human_name) %> - <%- end -%> -<% end -%> -<% end -%> -<% else -%> - -# This model initially had no columns defined. If you add columns to the -# model remove the '{}' from the fixture names and add the columns immediately -# below each fixture, per the syntax in the comments below -# -one: {} -# column: value -# -two: {} -# column: value -<% end -%> diff --git a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt new file mode 100644 index 0000000000..0681780c97 --- /dev/null +++ b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt @@ -0,0 +1,29 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +<% unless attributes.empty? -%> +<% %w(one two).each do |name| %> +<%= name %>: +<% attributes.each do |attribute| -%> + <%- if attribute.password_digest? -%> + password_digest: <%%= BCrypt::Password.create('secret') %> + <%- elsif attribute.reference? -%> + <%= yaml_key_value(attribute.column_name.sub(/_id$/, ''), attribute.default || name) %> + <%- else -%> + <%= yaml_key_value(attribute.column_name, attribute.default) %> + <%- end -%> + <%- if attribute.polymorphic? -%> + <%= yaml_key_value("#{attribute.name}_type", attribute.human_name) %> + <%- end -%> +<% end -%> +<% end -%> +<% else -%> + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value +<% end -%> diff --git a/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb b/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb deleted file mode 100644 index c9bc7d5b90..0000000000 --- a/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'test_helper' - -<% module_namespacing do -%> -class <%= class_name %>Test < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end -<% end -%> diff --git a/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb.tt b/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb.tt new file mode 100644 index 0000000000..c9bc7d5b90 --- /dev/null +++ b/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb.tt @@ -0,0 +1,9 @@ +require 'test_helper' + +<% module_namespacing do -%> +class <%= class_name %>Test < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end +<% end -%> -- cgit v1.2.3