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
data/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gemspec
4
-
5
- version = ENV["RAILS_VERSION"] || "5.0"
6
-
7
- eval_gemfile File.expand_path("../gemfiles/#{version}.gemfile", __FILE__)
@@ -1,76 +0,0 @@
1
- .autotest
2
- .gemtest
3
- .travis.yml
4
- CHANGELOG.rdoc
5
- Gemfile
6
- LICENSE
7
- Manifest.txt
8
- README.rdoc
9
- Rakefile
10
- gemfiles/5.0.gemfile
11
- gemfiles/head.gemfile
12
- lib/generators/.document
13
- lib/generators/minitest.rb
14
- lib/generators/minitest/controller/controller_generator.rb
15
- lib/generators/minitest/controller/templates/controller_spec.rb
16
- lib/generators/minitest/controller/templates/controller_test.rb
17
- lib/generators/minitest/generator/generator_generator.rb
18
- lib/generators/minitest/generator/templates/generator_spec.rb
19
- lib/generators/minitest/generator/templates/generator_test.rb
20
- lib/generators/minitest/helper/helper_generator.rb
21
- lib/generators/minitest/install/install_generator.rb
22
- lib/generators/minitest/install/templates/test_helper.rb
23
- lib/generators/minitest/integration/integration_generator.rb
24
- lib/generators/minitest/integration/templates/integration_spec.rb
25
- lib/generators/minitest/integration/templates/integration_test.rb
26
- lib/generators/minitest/job/job_generator.rb
27
- lib/generators/minitest/job/templates/job_spec.rb
28
- lib/generators/minitest/job/templates/job_test.rb
29
- lib/generators/minitest/mailer/mailer_generator.rb
30
- lib/generators/minitest/mailer/templates/mailer_spec.rb
31
- lib/generators/minitest/mailer/templates/mailer_test.rb
32
- lib/generators/minitest/mailer/templates/preview.rb
33
- lib/generators/minitest/model/model_generator.rb
34
- lib/generators/minitest/model/templates/fixtures.yml
35
- lib/generators/minitest/model/templates/model_spec.rb
36
- lib/generators/minitest/model/templates/model_test.rb
37
- lib/generators/minitest/scaffold/scaffold_generator.rb
38
- lib/generators/minitest/scaffold/templates/api_controller_spec.rb
39
- lib/generators/minitest/scaffold/templates/api_controller_test.rb
40
- lib/generators/minitest/scaffold/templates/controller_spec.rb
41
- lib/generators/minitest/scaffold/templates/controller_test.rb
42
- lib/minitest-rails.rb
43
- lib/minitest/rails.rb
44
- lib/minitest/rails/assertions.rb
45
- lib/minitest/rails/constant_lookup.rb
46
- lib/minitest/rails/controller.rb
47
- lib/minitest/rails/expectations.rb
48
- lib/minitest/rails/railtie.rb
49
- lib/minitest/rails/version.rb
50
- minitest-rails.gemspec
51
- tasks/test.rake
52
- test/generators/test_controller_generator.rb
53
- test/generators/test_generator_generator.rb
54
- test/generators/test_helper_generator.rb
55
- test/generators/test_install_generator.rb
56
- test/generators/test_job_generator.rb
57
- test/generators/test_mailer_generator.rb
58
- test/generators/test_model_generator.rb
59
- test/generators/test_scaffold_generator.rb
60
- test/helper.rb
61
- test/rails/action_dispatch/test_assertions.rb
62
- test/rails/action_dispatch/test_expectations.rb
63
- test/rails/action_dispatch/test_spec_type.rb
64
- test/rails/action_mailer/test_mailers.rb
65
- test/rails/action_mailer/test_spec_type.rb
66
- test/rails/action_view/test_helpers.rb
67
- test/rails/action_view/test_spec_type.rb
68
- test/rails/active_job/test_assertions.rb
69
- test/rails/active_job/test_expectations.rb
70
- test/rails/active_job/test_spec_type.rb
71
- test/rails/active_support/test_assertions.rb
72
- test/rails/active_support/test_expectations.rb
73
- test/rails/active_support/test_spec_type.rb
74
- test/rails/generators/test_spec_type.rb
75
- test/rails/test_constant_lookup.rb
76
- test/test_sanity.rb
@@ -1,110 +0,0 @@
1
- = minitest-rails
2
-
3
- Minitest integration for Rails 5
4
-
5
- {<img src="https://secure.travis-ci.org/blowmage/minitest-rails.png" alt="Build Status" />}[http://travis-ci.org/blowmage/minitest-rails]
6
- {<img src="https://codeclimate.com/github/blowmage/minitest-rails.png" />}[https://codeclimate.com/github/blowmage/minitest-rails]
7
- {<img src="https://badges.gitter.im/Join Chat.svg" />}[https://gitter.im/blowmage/minitest-rails]
8
-
9
- == Install
10
-
11
- gem install minitest-rails
12
-
13
- This installs the following gems:
14
-
15
- minitest
16
-
17
- == Configure
18
-
19
- Create a new rails app:
20
-
21
- rails new MyApp
22
-
23
- Add <tt>minitest-rails</tt> to the Gemfile:
24
-
25
- gem "minitest-rails"
26
-
27
- If you are running Rails 4.1 or 4.2, be sure to specify a 2.x release in the Gemfile:
28
-
29
- gem "minitest-rails", "~> 1.0"
30
-
31
- If you are running Rails 4.0 or earlier, be sure to specify a 1.x release in the Gemfile:
32
-
33
- gem "minitest-rails", "~> 1.0"
34
-
35
- Next run the installation generator with the following:
36
-
37
- rails generate minitest:install
38
-
39
- This will add the <tt>test_helper.rb</tt> file to the <tt>test</tt> directory.
40
-
41
- == Usage
42
-
43
- This project aims to enable Minitest within the Rails TestCase classes.
44
- Your test will continue to inherit from <tt>ActiveSupport::TestCase</tt>, which will now support the spec DSL.
45
- You can generate test files using the <tt>Minitest::Spec</tt> DSL with the standard model, controller, resource, and other generators:
46
-
47
- rails generate model User
48
-
49
- And you can specify generating the tests without the <tt>Minitest::Spec</tt> DSL on any of the generators by providing the <tt>--no-spec</tt> option:
50
-
51
- rails generate model User --no-spec
52
-
53
- And you can specify not generating the fixture for a model by providing the <tt>--skip-fixture</tt> option:
54
-
55
- rails generate model User --skip-fixture
56
-
57
- You can also set these as defaults by adding the following to the <tt>config/application.rb</tt> file:
58
-
59
- config.generators do |g|
60
- g.test_framework :minitest, spec: false, fixture: false
61
- end
62
-
63
- == Running Tests
64
-
65
- To run your tests use the <tt>rails test</tt> that ship with rails.
66
-
67
- == Using Rails 4.1 or 4.2
68
-
69
- For information on using minitest-rails with Rails 4.1 and 4.2, see the README for the 2.x branch: https://github.com/blowmage/minitest-rails/tree/2.x#readme
70
-
71
- == Using Rails 4.0 or earlier
72
-
73
- For information on using minitest-rails with Rails 3.0 through 4.0, see the README for the 1.x branch: https://github.com/blowmage/minitest-rails/tree/1.x#readme
74
-
75
- == Capybara
76
-
77
- You can use Capybara for feature tests by adding <tt>minitest-rails-capybara</tt> as a dependency. See the README for more information: https://github.com/blowmage/minitest-rails-capybara
78
-
79
- == Get Involved
80
-
81
- Join the mailing list to get help or offer suggestions.
82
-
83
- https://groups.google.com/group/minitest-rails
84
-
85
- Or join the discussion on Gitter.
86
-
87
- https://gitter.im/blowmage/minitest-rails
88
-
89
- == License
90
-
91
- Copyright (c) 2014 Mike Moore
92
-
93
- Permission is hereby granted, free of charge, to any person obtaining
94
- a copy of this software and associated documentation files (the
95
- "Software"), to deal in the Software without restriction, including
96
- without limitation the rights to use, copy, modify, merge, publish,
97
- distribute, sublicense, and/or sell copies of the Software, and to
98
- permit persons to whom the Software is furnished to do so, subject to
99
- the following conditions:
100
-
101
- The above copyright notice and this permission notice shall be
102
- included in all copies or substantial portions of the Software.
103
-
104
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
105
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
106
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
107
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
108
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
109
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
110
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,30 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- require "rubygems"
4
- require "hoe"
5
-
6
- Hoe.plugin :git
7
- Hoe.plugin :gemspec
8
-
9
- Hoe.spec "minitest-rails" do
10
- developer "Mike Moore", "mike@blowmage.com"
11
-
12
- self.summary = "Minitest integration for Rails"
13
- self.description = "Adds Minitest as the default testing library in Rails"
14
- self.urls = ["http://blowmage.com/minitest-rails"]
15
-
16
- self.history_file = "CHANGELOG.rdoc"
17
- self.readme_file = "README.rdoc"
18
- self.testlib = :minitest
19
-
20
- license "MIT"
21
-
22
- dependency "minitest", "~> 5.8"
23
- dependency "railties", "~> 5.0"
24
- dependency "fakefs", "= 0.4.3", :dev
25
- dependency "minitest-focus", "~> 1.1", :dev
26
- end
27
-
28
- Dir["tasks/**/*.rake"].each { |t| load t }
29
-
30
- # vim: syntax=ruby
@@ -1,5 +0,0 @@
1
- source "http://rubygems.org" do
2
- gem "rails", "~> 5.0.0"
3
- gem "sqlite3"
4
- gem "rake"
5
- end
@@ -1,5 +0,0 @@
1
- source "http://rubygems.org" do
2
- gem "rails", github: "rails/rails"
3
- gem "sqlite3"
4
- gem "rake"
5
- end
File without changes
@@ -1,19 +0,0 @@
1
- ENV["RAILS_ENV"] = "test"
2
- require File.expand_path("../../config/environment", __FILE__)
3
- require "rails/test_help"
4
- require "minitest/rails"
5
-
6
- # To add Capybara feature tests add `gem "minitest-rails-capybara"`
7
- # to the test group in the Gemfile and uncomment the following:
8
- # require "minitest/rails/capybara"
9
-
10
- # Uncomment for awesome colorful output
11
- # require "minitest/pride"
12
-
13
- class ActiveSupport::TestCase
14
- <% unless options[:skip_active_record] -%>
15
- # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
16
- fixtures :all
17
- <% end -%>
18
- # Add more helper methods to be used by all tests here...
19
- end
@@ -1,8 +0,0 @@
1
- require "test_helper"
2
-
3
- # To be handled correctly this spec must end with "Integration Test"
4
- describe "<%= class_name %> Integration Test" do
5
- # it "must be a real test" do
6
- # flunk "Need real tests"
7
- # end
8
- end
@@ -1,7 +0,0 @@
1
- require "test_helper"
2
-
3
- class <%= class_name %>Test < ActionDispatch::IntegrationTest
4
- # def test_sanity
5
- # flunk "Need real tests"
6
- # end
7
- end
@@ -1,9 +0,0 @@
1
- require "test_helper"
2
-
3
- <% module_namespacing do -%>
4
- describe <%= class_name %>Job do
5
- # it "must be a real test" do
6
- # flunk "Need real tests"
7
- # end
8
- end
9
- <% end -%>
@@ -1,20 +0,0 @@
1
- require "test_helper"
2
-
3
- <% module_namespacing do -%>
4
- describe <%= class_name %>Mailer do
5
- <% actions.each do |action| -%>
6
- it "<%= action %>" do
7
- mail = <%= class_name %>.<%= action %>
8
- value(mail.subject).must_equal <%= action.to_s.humanize.inspect %>
9
- value(mail.to).must_equal ["to@example.org"]
10
- value(mail.from).must_equal ["from@example.com"]
11
- value(mail.body.encoded).must_match "Hi"
12
- end
13
- <% end -%>
14
- <% if actions.blank? -%>
15
- # it "must be a real test" do
16
- # flunk "Need real tests"
17
- # end
18
- <% end -%>
19
- end
20
- <% end -%>
@@ -1,11 +0,0 @@
1
- require "test_helper"
2
-
3
- <% module_namespacing do -%>
4
- describe <%= class_name %> do
5
- let(:<%= file_name %>) { <%= class_name %>.new }
6
-
7
- it "must be valid" do
8
- value(<%= file_name %>).must_be :valid?
9
- end
10
- end
11
- <% end -%>
@@ -1,13 +0,0 @@
1
- require "test_helper"
2
-
3
- <% module_namespacing do -%>
4
- class <%= class_name %>Test < ActiveSupport::TestCase
5
- def <%= file_name %>
6
- @<%= file_name %> ||= <%= class_name %>.new
7
- end
8
-
9
- def test_valid
10
- assert <%= file_name %>.valid?
11
- end
12
- end
13
- <% end -%>
@@ -1,42 +0,0 @@
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
- let(:<%= singular_table_name %>) { <%= fixture_name %> :one }
10
-
11
- it "gets index" do
12
- get <%= index_helper %>_url
13
- value(response).must_be :success?
14
- end
15
-
16
- it "creates <%= singular_table_name %>" do
17
- expect {
18
- post <%= index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> }
19
- }.must_change "<%= class_name %>.count"
20
-
21
- value(response.status).must_equal 201
22
- end
23
-
24
- it "shows <%= singular_table_name %>" do
25
- get <%= show_helper %>
26
- value(response).must_be :success?
27
- end
28
-
29
- it "updates <%= singular_table_name %>" do
30
- patch <%= show_helper %>, params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> }
31
- value(response.status).must_equal 200
32
- end
33
-
34
- it "destroys <%= singular_table_name %>" do
35
- expect {
36
- delete <%= show_helper %>
37
- }.must_change "<%= class_name %>.count", -1
38
-
39
- value(response.status).must_equal 204
40
- end
41
- end
42
- <% end -%>
@@ -1,44 +0,0 @@
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
- def <%= singular_table_name %>
10
- @<%= singular_table_name %> ||= <%= fixture_name %> :one
11
- end
12
-
13
- def test_index
14
- get <%= index_helper %>_url
15
- assert_response :success
16
- end
17
-
18
- def test_create
19
- assert_difference('<%= class_name %>.count') do
20
- post <%= index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> }
21
- end
22
-
23
- assert_response 201
24
- end
25
-
26
- def test_show
27
- get <%= show_helper %>
28
- assert_response :success
29
- end
30
-
31
- def test_update
32
- patch <%= show_helper %>, params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> }
33
- assert_response 200
34
- end
35
-
36
- def test_destroy
37
- assert_difference('<%= class_name %>.count', -1) do
38
- delete <%= show_helper %>
39
- end
40
-
41
- assert_response 204
42
- end
43
- end
44
- <% end -%>
@@ -1,52 +0,0 @@
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 "gets index" do
12
- get <%= index_helper %>_url
13
- value(response).must_be :success?
14
- end
15
-
16
- it "gets new" do
17
- get <%= new_helper %>
18
- value(response).must_be :success?
19
- end
20
-
21
- it "creates <%= singular_table_name %>" do
22
- expect {
23
- post <%= index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> }
24
- }.must_change "<%= class_name %>.count"
25
-
26
- must_redirect_to <%= singular_table_name %>_path(<%= class_name %>.last)
27
- end
28
-
29
- it "shows <%= singular_table_name %>" do
30
- get <%= show_helper %>
31
- value(response).must_be :success?
32
- end
33
-
34
- it "gets edit" do
35
- get <%= edit_helper %>
36
- value(response).must_be :success?
37
- end
38
-
39
- it "updates <%= singular_table_name %>" do
40
- patch <%= show_helper %>, params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> }
41
- must_redirect_to <%= singular_table_name %>_path(<%= "#{singular_table_name}" %>)
42
- end
43
-
44
- it "destroys <%= singular_table_name %>" do
45
- expect {
46
- delete <%= show_helper %>
47
- }.must_change "<%= class_name %>.count", -1
48
-
49
- must_redirect_to <%= index_helper %>_path
50
- end
51
- end
52
- <% end -%>