minitest-rails 3.0.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +5 -0
  3. data/LICENSE +1 -1
  4. data/README.md +94 -0
  5. data/UPDATING.md +31 -0
  6. data/lib/generators/minitest.rb +17 -4
  7. data/lib/generators/minitest/controller/controller_generator.rb +6 -9
  8. data/lib/generators/minitest/controller/templates/{controller_spec.rb → functional_spec.rb.tt} +4 -4
  9. data/lib/generators/minitest/controller/templates/{controller_test.rb → functional_test.rb.tt} +3 -3
  10. data/lib/generators/minitest/generator/generator_generator.rb +3 -8
  11. data/lib/generators/minitest/generator/templates/{generator_spec.rb → generator_spec.rb.tt} +2 -2
  12. data/lib/generators/minitest/generator/templates/{generator_test.rb → generator_test.rb.tt} +1 -2
  13. data/lib/generators/minitest/helper/helper_generator.rb +5 -3
  14. data/lib/generators/minitest/install/install_generator.rb +19 -8
  15. data/lib/generators/minitest/install/templates/test/test_helper.rb.tt +16 -0
  16. data/lib/generators/minitest/integration/integration_generator.rb +12 -9
  17. data/lib/generators/minitest/integration/templates/integration_spec.rb.tt +9 -0
  18. data/lib/generators/minitest/integration/templates/integration_test.rb.tt +9 -0
  19. data/lib/generators/minitest/job/job_generator.rb +13 -10
  20. data/lib/generators/minitest/job/templates/unit_spec.rb.tt +9 -0
  21. data/lib/generators/minitest/job/templates/{job_test.rb → unit_test.rb.tt} +3 -3
  22. data/lib/generators/minitest/mailer/mailer_generator.rb +8 -11
  23. data/lib/generators/minitest/mailer/templates/functional_spec.rb.tt +21 -0
  24. data/lib/generators/minitest/mailer/templates/{mailer_test.rb → functional_test.rb.tt} +3 -3
  25. data/lib/generators/minitest/mailer/templates/{preview.rb → preview.rb.tt} +0 -0
  26. data/lib/generators/minitest/model/model_generator.rb +9 -12
  27. data/lib/generators/minitest/model/templates/{fixtures.yml → fixtures.yml.tt} +3 -3
  28. data/lib/generators/minitest/model/templates/unit_spec.rb.tt +9 -0
  29. data/lib/generators/minitest/model/templates/unit_test.rb.tt +9 -0
  30. data/lib/generators/minitest/plugin/plugin_generator.rb +15 -0
  31. data/lib/generators/minitest/plugin/templates/%file_name%_test.rb.tt +15 -0
  32. data/lib/generators/minitest/plugin/templates/test_helper.rb +2 -0
  33. data/lib/generators/minitest/scaffold/scaffold_generator.rb +21 -23
  34. data/lib/generators/minitest/scaffold/templates/api_functional_spec.rb.tt +42 -0
  35. data/lib/generators/minitest/scaffold/templates/api_functional_test.rb.tt +44 -0
  36. data/lib/generators/minitest/scaffold/templates/functional_spec.rb.tt +52 -0
  37. data/lib/generators/minitest/scaffold/templates/{controller_test.rb → functional_test.rb.tt} +16 -16
  38. data/lib/minitest/rails.rb +45 -108
  39. data/lib/minitest/rails/assertions.rb +5 -906
  40. data/lib/minitest/rails/assertions/action_dispatch.rb +356 -0
  41. data/lib/minitest/rails/assertions/action_mailer.rb +115 -0
  42. data/lib/minitest/rails/assertions/action_view.rb +356 -0
  43. data/lib/minitest/rails/assertions/active_job.rb +151 -0
  44. data/lib/minitest/rails/assertions/active_support.rb +29 -0
  45. data/lib/minitest/rails/expectations.rb +4 -565
  46. data/lib/minitest/rails/expectations/action_dispatch.rb +307 -0
  47. data/lib/minitest/rails/expectations/action_mailer.rb +136 -0
  48. data/lib/minitest/rails/expectations/active_job.rb +182 -0
  49. data/lib/minitest/rails/expectations/active_support.rb +42 -0
  50. data/lib/minitest/rails/railtie.rb +3 -2
  51. data/lib/minitest/rails/version.rb +1 -1
  52. metadata +72 -89
  53. data/.autotest +0 -23
  54. data/.gemtest +0 -0
  55. data/.travis.yml +0 -25
  56. data/CHANGELOG.rdoc +0 -223
  57. data/Gemfile +0 -7
  58. data/Manifest.txt +0 -76
  59. data/README.rdoc +0 -110
  60. data/Rakefile +0 -30
  61. data/gemfiles/5.0.gemfile +0 -5
  62. data/gemfiles/head.gemfile +0 -5
  63. data/lib/generators/.document +0 -0
  64. data/lib/generators/minitest/install/templates/test_helper.rb +0 -19
  65. data/lib/generators/minitest/integration/templates/integration_spec.rb +0 -8
  66. data/lib/generators/minitest/integration/templates/integration_test.rb +0 -7
  67. data/lib/generators/minitest/job/templates/job_spec.rb +0 -9
  68. data/lib/generators/minitest/mailer/templates/mailer_spec.rb +0 -20
  69. data/lib/generators/minitest/model/templates/model_spec.rb +0 -11
  70. data/lib/generators/minitest/model/templates/model_test.rb +0 -13
  71. data/lib/generators/minitest/scaffold/templates/api_controller_spec.rb +0 -42
  72. data/lib/generators/minitest/scaffold/templates/api_controller_test.rb +0 -44
  73. data/lib/generators/minitest/scaffold/templates/controller_spec.rb +0 -52
  74. data/lib/minitest/rails/constant_lookup.rb +0 -52
  75. data/lib/minitest/rails/controller.rb +0 -14
  76. data/minitest-rails.gemspec +0 -48
  77. data/tasks/test.rake +0 -29
  78. data/test/generators/test_controller_generator.rb +0 -58
  79. data/test/generators/test_generator_generator.rb +0 -58
  80. data/test/generators/test_helper_generator.rb +0 -34
  81. data/test/generators/test_install_generator.rb +0 -27
  82. data/test/generators/test_job_generator.rb +0 -45
  83. data/test/generators/test_mailer_generator.rb +0 -42
  84. data/test/generators/test_model_generator.rb +0 -80
  85. data/test/generators/test_scaffold_generator.rb +0 -26
  86. data/test/helper.rb +0 -93
  87. data/test/rails/action_dispatch/test_assertions.rb +0 -39
  88. data/test/rails/action_dispatch/test_expectations.rb +0 -39
  89. data/test/rails/action_dispatch/test_spec_type.rb +0 -49
  90. data/test/rails/action_mailer/test_mailers.rb +0 -109
  91. data/test/rails/action_mailer/test_spec_type.rb +0 -47
  92. data/test/rails/action_view/test_helpers.rb +0 -73
  93. data/test/rails/action_view/test_spec_type.rb +0 -58
  94. data/test/rails/active_job/test_assertions.rb +0 -46
  95. data/test/rails/active_job/test_expectations.rb +0 -55
  96. data/test/rails/active_job/test_spec_type.rb +0 -49
  97. data/test/rails/active_support/test_assertions.rb +0 -31
  98. data/test/rails/active_support/test_expectations.rb +0 -21
  99. data/test/rails/active_support/test_spec_type.rb +0 -28
  100. data/test/rails/generators/test_spec_type.rb +0 -45
  101. data/test/rails/test_constant_lookup.rb +0 -58
  102. data/test/test_sanity.rb +0 -7
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ <% module_namespacing do -%>
4
+ describe <%= class_name %>Job do
5
+ # it "does a thing" do
6
+ # <%= spec_expectation_monad %>(1+1).must_equal 2
7
+ # end
8
+ end
9
+ <% end -%>
@@ -1,9 +1,9 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  <% module_namespacing do -%>
4
4
  class <%= class_name %>JobTest < ActiveJob::TestCase
5
- # def test_sanity
6
- # flunk "Need real tests"
5
+ # def test_truth
6
+ # assert true
7
7
  # end
8
8
  end
9
9
  <% end -%>
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "generators/minitest"
2
4
 
3
- module Minitest
4
- module Generators
5
- class MailerGenerator < Base
5
+ module Minitest # :nodoc:
6
+ module Generators # :nodoc:
7
+ class MailerGenerator < Base # :nodoc:
6
8
  argument :actions, type: :array, default: [], banner: "method method"
7
9
 
8
10
  def check_class_collision
@@ -10,22 +12,17 @@ module Minitest
10
12
  end
11
13
 
12
14
  def create_test_files
13
- if options[:spec]
14
- template_file = "mailer_spec.rb"
15
- else
16
- template_file = "mailer_test.rb"
17
- end
18
- template template_file, File.join("test/mailers", class_path, "#{file_name}_mailer_test.rb")
15
+ template "functional_#{test_file_type}.rb", File.join("test/mailers", class_path, "#{file_name}_mailer_test.rb")
19
16
  end
20
17
 
21
18
  def create_preview_files
22
19
  template "preview.rb", File.join("test/mailers/previews", class_path, "#{file_name}_mailer_preview.rb")
23
20
  end
24
21
 
25
- protected
22
+ private
26
23
 
27
24
  def file_name
28
- @_file_name ||= super.gsub(/_mailer/i, "")
25
+ @_file_name ||= super.sub(/_mailer\z/i, "")
29
26
  end
30
27
  end
31
28
  end
@@ -0,0 +1,21 @@
1
+ require "test_helper"
2
+
3
+ <% module_namespacing do -%>
4
+ describe <%= class_name %>Mailer do
5
+ <% actions.each do |action| -%>
6
+ it "creates <%= action %> email" do
7
+ mail = <%= class_name %>Mailer.<%= action %>
8
+ mail.subject.must_equal <%= action.to_s.humanize.inspect %>
9
+ mail.to.must_equal ["to@example.org"]
10
+ mail.from.must_equal ["from@example.com"]
11
+ mail.body.encoded.must_equal "Hi"
12
+ end
13
+
14
+ <% end -%>
15
+ <% if actions.blank? -%>
16
+ # it "does a thing" do
17
+ # <%= spec_expectation_monad %>(1+1).must_equal 2
18
+ # end
19
+ <% end -%>
20
+ end
21
+ <% end -%>
@@ -1,4 +1,4 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  <% module_namespacing do -%>
4
4
  class <%= class_name %>MailerTest < ActionMailer::TestCase
@@ -13,8 +13,8 @@ class <%= class_name %>MailerTest < ActionMailer::TestCase
13
13
 
14
14
  <% end -%>
15
15
  <% if actions.blank? -%>
16
- # def test_sanity
17
- # flunk "Need real tests"
16
+ # def test_truth
17
+ # assert true
18
18
  # end
19
19
  <% end -%>
20
20
  end
@@ -1,22 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "generators/minitest"
2
4
 
3
- module Minitest
4
- module Generators
5
- class ModelGenerator < Base
6
- RESERVED_YAML_KEYWORDS = %w(y yes n no true false on off null)
5
+ module Minitest # :nodoc:
6
+ module Generators # :nodoc:
7
+ class ModelGenerator < Base # :nodoc:
8
+ RESERVED_YAML_KEYWORDS = %w[y yes n no true false on off null].freeze
7
9
 
8
10
  argument :attributes, type: :array, default: [], banner: "field:type field:type"
9
- class_option :fixture, type: :boolean, default: true, desc: "Create fixture file"
11
+ class_option :fixture, type: :boolean
10
12
 
11
13
  check_class_collision suffix: "Test"
12
14
 
13
15
  def create_test_file
14
- if options[:spec]
15
- template_file = "model_spec.rb"
16
- else
17
- template_file = "model_test.rb"
18
- end
19
- template template_file, File.join("test/models", class_path, "#{file_name}_test.rb")
16
+ template "unit_#{test_file_type}.rb", File.join("test/models", class_path, "#{file_name}_test.rb")
20
17
  end
21
18
 
22
19
  hook_for :fixture_replacement
@@ -29,7 +26,7 @@ module Minitest
29
26
 
30
27
  private
31
28
 
32
- def yaml_key_value(key, value)
29
+ def yaml_key_value key, value
33
30
  if RESERVED_YAML_KEYWORDS.include?(key.downcase)
34
31
  "'#{key}': #{value}"
35
32
  else
@@ -4,9 +4,9 @@
4
4
  <%= name %>:
5
5
  <% attributes.each do |attribute| -%>
6
6
  <%- if attribute.password_digest? -%>
7
- password_digest: <%%= BCrypt::Password.create("secret") %>
7
+ password_digest: <%%= BCrypt::Password.create('secret') %>
8
8
  <%- elsif attribute.reference? -%>
9
- <%= yaml_key_value(attribute.column_name.sub(/_id$/, ""), attribute.default || name) %>
9
+ <%= yaml_key_value(attribute.column_name.sub(/_id$/, ''), attribute.default || name) %>
10
10
  <%- else -%>
11
11
  <%= yaml_key_value(attribute.column_name, attribute.default) %>
12
12
  <%- end -%>
@@ -18,7 +18,7 @@
18
18
  <% else -%>
19
19
 
20
20
  # This model initially had no columns defined. If you add columns to the
21
- # model remove the "{}" from the fixture names and add the columns immediately
21
+ # model remove the '{}' from the fixture names and add the columns immediately
22
22
  # below each fixture, per the syntax in the comments below
23
23
  #
24
24
  one: {}
@@ -0,0 +1,9 @@
1
+ require "test_helper"
2
+
3
+ <% module_namespacing do -%>
4
+ describe <%= class_name %> do
5
+ # it "does a thing" do
6
+ # <%= spec_expectation_monad %>(1+1).must_equal 2
7
+ # end
8
+ end
9
+ <% end -%>
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ <% module_namespacing do -%>
4
+ class <%= class_name %>Test < ActiveSupport::TestCase
5
+ # def test_truth
6
+ # assert true
7
+ # end
8
+ end
9
+ <% end -%>
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "generators/minitest"
4
+
5
+ module Minitest # :nodoc:
6
+ module Generators # :nodoc:
7
+ class PluginGenerator < Base # :nodoc:
8
+ check_class_collision suffix: "Test"
9
+
10
+ def create_test_files
11
+ directory ".", "test"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ require 'test_helper'
2
+
3
+ <%- if options[:spec] -%>
4
+ describe <%= class_name %> do
5
+ # it "does a thing" do
6
+ # <%= spec_expectation_monad %>(1+1).must_equal 2
7
+ # end
8
+ end
9
+ <%- else -%>
10
+ class <%= class_name %>Test < ActiveSupport::TestCase
11
+ # def test_truth
12
+ # assert true
13
+ # end
14
+ end
15
+ <%- end -%>
@@ -0,0 +1,2 @@
1
+ require "active_support/testing/autorun"
2
+ require "active_support"
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "generators/minitest"
2
4
  require "rails/generators/resource_helpers"
3
5
 
4
- module Minitest
5
- module Generators
6
- class ScaffoldGenerator < Base
6
+ module Minitest # :nodoc:
7
+ module Generators # :nodoc:
8
+ class ScaffoldGenerator < Base # :nodoc:
7
9
  include ::Rails::Generators::ResourceHelpers
8
10
 
9
11
  check_class_collision suffix: "ControllerTest"
@@ -14,19 +16,7 @@ module Minitest
14
16
  argument :attributes, type: :array, default: [], banner: "field:type field:type"
15
17
 
16
18
  def create_test_files
17
- if options.api?
18
- if options[:spec]
19
- template_file = "api_controller_spec.rb"
20
- else
21
- template_file = "api_controller_test.rb"
22
- end
23
- else
24
- if options[:spec]
25
- template_file = "controller_spec.rb"
26
- else
27
- template_file = "controller_test.rb"
28
- end
29
- end
19
+ template_file = options.api? ? "api_functional_#{test_file_type}.rb" : "functional_#{test_file_type}.rb"
30
20
  template template_file,
31
21
  File.join("test/controllers", controller_class_path, "#{controller_file_name}_controller_test.rb")
32
22
  end
@@ -34,7 +24,7 @@ module Minitest
34
24
  def fixture_name
35
25
  @fixture_name ||=
36
26
  if mountable_engine?
37
- "%s_%s" % [namespaced_path, table_name]
27
+ (namespace_dirs + [table_name]).join("_")
38
28
  else
39
29
  table_name
40
30
  end
@@ -42,17 +32,25 @@ module Minitest
42
32
 
43
33
  private
44
34
 
35
+ def attributes_string
36
+ attributes_hash.map { |k, v| "#{k}: #{v}" }.join(", ")
37
+ end
38
+
45
39
  def attributes_hash
46
- return if attributes_names.empty?
40
+ return {} if attributes_names.empty?
47
41
 
48
42
  attributes_names.map do |name|
49
- if %w(password password_confirmation).include?(name) && attributes.any?(&:password_digest?)
50
- "#{name}: 'secret'"
43
+ if %w[password password_confirmation].include?(name) && attributes.any?(&:password_digest?)
44
+ [name.to_s, "'secret'"]
51
45
  else
52
- # don't use the ivar, use the accessor method
53
- "#{name}: #{singular_table_name}.#{name}"
46
+ [name.to_s, "@#{singular_table_name}.#{name}"]
54
47
  end
55
- end.sort.join(", ")
48
+ end.sort.to_h
49
+ end
50
+
51
+ def boolean? name
52
+ attribute = attributes.find { |attr| attr.name == name }
53
+ attribute&.type == :boolean
56
54
  end
57
55
  end
58
56
  end
@@ -0,0 +1,42 @@
1
+ require "test_helper"
2
+
3
+ <% module_namespacing do -%>
4
+ describe <%= controller_class_name %>Controller do
5
+ <%- if mountable_engine? -%>
6
+ include Engine.routes.url_helpers
7
+
8
+ <%- end -%>
9
+ let(:<%= singular_table_name %>) { <%= fixture_name %>(:one) }
10
+
11
+ it "should get index" do
12
+ get <%= index_helper %>_url, as: :json
13
+ must_respond_with :success
14
+ end
15
+
16
+ it "should create <%= singular_table_name %>" do
17
+ <%= spec_expectation_monad %> do
18
+ post <%= index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }, as: :json
19
+ end.must_differ "<%= class_name %>.count"
20
+
21
+ must_respond_with 201
22
+ end
23
+
24
+ it "should show <%= singular_table_name %>" do
25
+ get <%= show_helper %>, as: :json
26
+ must_respond_with :success
27
+ end
28
+
29
+ it "should update <%= singular_table_name %>" do
30
+ patch <%= show_helper %>, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }, as: :json
31
+ must_respond_with 200
32
+ end
33
+
34
+ it "should destroy <%= singular_table_name %>" do
35
+ <%= spec_expectation_monad %> do
36
+ delete <%= show_helper %>, as: :json
37
+ end.must_differ "<%= class_name %>.count", -1
38
+
39
+ must_respond_with 204
40
+ end
41
+ end
42
+ <% end -%>
@@ -0,0 +1,44 @@
1
+ require "test_helper"
2
+
3
+ <% module_namespacing do -%>
4
+ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTest
5
+ <%- if mountable_engine? -%>
6
+ include Engine.routes.url_helpers
7
+
8
+ <%- end -%>
9
+ setup do
10
+ @<%= singular_table_name %> = <%= fixture_name %>(:one)
11
+ end
12
+
13
+ def test_get_index
14
+ get <%= index_helper %>_url, as: :json
15
+ assert_response :success
16
+ end
17
+
18
+ def test_create_<%= singular_table_name %>
19
+ assert_difference("<%= class_name %>.count") do
20
+ post <%= index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }, as: :json
21
+ end
22
+
23
+ assert_response 201
24
+ end
25
+
26
+ def test_show_<%= singular_table_name %>
27
+ get <%= show_helper %>, as: :json
28
+ assert_response :success
29
+ end
30
+
31
+ def test_update_<%= singular_table_name %>
32
+ patch <%= show_helper %>, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }, as: :json
33
+ assert_response 200
34
+ end
35
+
36
+ def test_destroy_<%= singular_table_name %>
37
+ assert_difference("<%= class_name %>.count", -1) do
38
+ delete <%= show_helper %>, as: :json
39
+ end
40
+
41
+ assert_response 204
42
+ end
43
+ end
44
+ <% end -%>
@@ -0,0 +1,52 @@
1
+ require "test_helper"
2
+
3
+ <% module_namespacing do -%>
4
+ describe <%= controller_class_name %>Controller do
5
+ <%- if mountable_engine? -%>
6
+ include Engine.routes.url_helpers
7
+
8
+ <%- end -%>
9
+ let(:<%= singular_table_name %>) { <%= fixture_name %>(:one) }
10
+
11
+ it "should get index" do
12
+ get <%= index_helper %>_url
13
+ must_respond_with :success
14
+ end
15
+
16
+ it "should get new" do
17
+ get <%= new_helper %>
18
+ must_respond_with :success
19
+ end
20
+
21
+ it "should create <%= singular_table_name %>" do
22
+ assert_difference("<%= class_name %>.count") do
23
+ post <%= index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }
24
+ end
25
+
26
+ must_redirect_to <%= singular_table_name %>_url(<%= class_name %>.last)
27
+ end
28
+
29
+ it "should show <%= singular_table_name %>" do
30
+ get <%= show_helper %>
31
+ must_respond_with :success
32
+ end
33
+
34
+ it "should get edit" do
35
+ get <%= edit_helper %>
36
+ must_respond_with :success
37
+ end
38
+
39
+ it "should update <%= singular_table_name %>" do
40
+ patch <%= show_helper %>, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }
41
+ must_redirect_to <%= singular_table_name %>_url(<%= "#{singular_table_name}" %>)
42
+ end
43
+
44
+ it "should destroy <%= singular_table_name %>" do
45
+ assert_difference("<%= class_name %>.count", -1) do
46
+ delete <%= show_helper %>
47
+ end
48
+
49
+ must_redirect_to <%= index_helper %>_url
50
+ end
51
+ end
52
+ <% end -%>
@@ -6,49 +6,49 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe
6
6
  include Engine.routes.url_helpers
7
7
 
8
8
  <%- end -%>
9
- def <%= singular_table_name %>
10
- @<%= singular_table_name %> ||= <%= fixture_name %> :one
9
+ setup do
10
+ @<%= singular_table_name %> = <%= fixture_name %>(:one)
11
11
  end
12
12
 
13
- def test_index
13
+ def test_get_index
14
14
  get <%= index_helper %>_url
15
15
  assert_response :success
16
16
  end
17
17
 
18
- def test_new
18
+ def test_get_new
19
19
  get <%= new_helper %>
20
20
  assert_response :success
21
21
  end
22
22
 
23
- def test_create
24
- assert_difference "<%= class_name %>.count" do
25
- post <%= index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> }
23
+ def test_create_<%= singular_table_name %>
24
+ assert_difference("<%= class_name %>.count") do
25
+ post <%= index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }
26
26
  end
27
27
 
28
- assert_redirected_to <%= singular_table_name %>_path(<%= class_name %>.last)
28
+ assert_redirected_to <%= singular_table_name %>_url(<%= class_name %>.last)
29
29
  end
30
30
 
31
- def test_show
31
+ def test_show_<%= singular_table_name %>
32
32
  get <%= show_helper %>
33
33
  assert_response :success
34
34
  end
35
35
 
36
- def test_edit
36
+ def test_get_edit
37
37
  get <%= edit_helper %>
38
38
  assert_response :success
39
39
  end
40
40
 
41
- def test_update
42
- patch <%= show_helper %>, params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> }
43
- assert_redirected_to <%= singular_table_name %>_path(<%= "#{singular_table_name}" %>)
41
+ def test_update_<%= singular_table_name %>
42
+ patch <%= show_helper %>, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }
43
+ assert_redirected_to <%= singular_table_name %>_url(<%= "@#{singular_table_name}" %>)
44
44
  end
45
45
 
46
- def test_destroy
47
- assert_difference "<%= class_name %>.count", -1 do
46
+ def test_destroy_<%= singular_table_name %>
47
+ assert_difference("<%= class_name %>.count", -1) do
48
48
  delete <%= show_helper %>
49
49
  end
50
50
 
51
- assert_redirected_to <%= index_helper %>_path
51
+ assert_redirected_to <%= index_helper %>_url
52
52
  end
53
53
  end
54
54
  <% end -%>