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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/LICENSE +1 -1
- data/README.md +94 -0
- data/UPDATING.md +31 -0
- data/lib/generators/minitest.rb +17 -4
- data/lib/generators/minitest/controller/controller_generator.rb +6 -9
- data/lib/generators/minitest/controller/templates/{controller_spec.rb → functional_spec.rb.tt} +4 -4
- data/lib/generators/minitest/controller/templates/{controller_test.rb → functional_test.rb.tt} +3 -3
- data/lib/generators/minitest/generator/generator_generator.rb +3 -8
- data/lib/generators/minitest/generator/templates/{generator_spec.rb → generator_spec.rb.tt} +2 -2
- data/lib/generators/minitest/generator/templates/{generator_test.rb → generator_test.rb.tt} +1 -2
- data/lib/generators/minitest/helper/helper_generator.rb +5 -3
- data/lib/generators/minitest/install/install_generator.rb +19 -8
- data/lib/generators/minitest/install/templates/test/test_helper.rb.tt +16 -0
- data/lib/generators/minitest/integration/integration_generator.rb +12 -9
- data/lib/generators/minitest/integration/templates/integration_spec.rb.tt +9 -0
- data/lib/generators/minitest/integration/templates/integration_test.rb.tt +9 -0
- data/lib/generators/minitest/job/job_generator.rb +13 -10
- data/lib/generators/minitest/job/templates/unit_spec.rb.tt +9 -0
- data/lib/generators/minitest/job/templates/{job_test.rb → unit_test.rb.tt} +3 -3
- data/lib/generators/minitest/mailer/mailer_generator.rb +8 -11
- data/lib/generators/minitest/mailer/templates/functional_spec.rb.tt +21 -0
- data/lib/generators/minitest/mailer/templates/{mailer_test.rb → functional_test.rb.tt} +3 -3
- data/lib/generators/minitest/mailer/templates/{preview.rb → preview.rb.tt} +0 -0
- data/lib/generators/minitest/model/model_generator.rb +9 -12
- data/lib/generators/minitest/model/templates/{fixtures.yml → fixtures.yml.tt} +3 -3
- data/lib/generators/minitest/model/templates/unit_spec.rb.tt +9 -0
- data/lib/generators/minitest/model/templates/unit_test.rb.tt +9 -0
- data/lib/generators/minitest/plugin/plugin_generator.rb +15 -0
- data/lib/generators/minitest/plugin/templates/%file_name%_test.rb.tt +15 -0
- data/lib/generators/minitest/plugin/templates/test_helper.rb +2 -0
- data/lib/generators/minitest/scaffold/scaffold_generator.rb +21 -23
- data/lib/generators/minitest/scaffold/templates/api_functional_spec.rb.tt +42 -0
- data/lib/generators/minitest/scaffold/templates/api_functional_test.rb.tt +44 -0
- data/lib/generators/minitest/scaffold/templates/functional_spec.rb.tt +52 -0
- data/lib/generators/minitest/scaffold/templates/{controller_test.rb → functional_test.rb.tt} +16 -16
- data/lib/minitest/rails.rb +45 -108
- data/lib/minitest/rails/assertions.rb +5 -906
- data/lib/minitest/rails/assertions/action_dispatch.rb +356 -0
- data/lib/minitest/rails/assertions/action_mailer.rb +115 -0
- data/lib/minitest/rails/assertions/action_view.rb +356 -0
- data/lib/minitest/rails/assertions/active_job.rb +151 -0
- data/lib/minitest/rails/assertions/active_support.rb +29 -0
- data/lib/minitest/rails/expectations.rb +4 -565
- data/lib/minitest/rails/expectations/action_dispatch.rb +307 -0
- data/lib/minitest/rails/expectations/action_mailer.rb +136 -0
- data/lib/minitest/rails/expectations/active_job.rb +182 -0
- data/lib/minitest/rails/expectations/active_support.rb +42 -0
- data/lib/minitest/rails/railtie.rb +3 -2
- data/lib/minitest/rails/version.rb +1 -1
- metadata +72 -89
- data/.autotest +0 -23
- data/.gemtest +0 -0
- data/.travis.yml +0 -25
- data/CHANGELOG.rdoc +0 -223
- data/Gemfile +0 -7
- data/Manifest.txt +0 -76
- data/README.rdoc +0 -110
- data/Rakefile +0 -30
- data/gemfiles/5.0.gemfile +0 -5
- data/gemfiles/head.gemfile +0 -5
- data/lib/generators/.document +0 -0
- data/lib/generators/minitest/install/templates/test_helper.rb +0 -19
- data/lib/generators/minitest/integration/templates/integration_spec.rb +0 -8
- data/lib/generators/minitest/integration/templates/integration_test.rb +0 -7
- data/lib/generators/minitest/job/templates/job_spec.rb +0 -9
- data/lib/generators/minitest/mailer/templates/mailer_spec.rb +0 -20
- data/lib/generators/minitest/model/templates/model_spec.rb +0 -11
- data/lib/generators/minitest/model/templates/model_test.rb +0 -13
- data/lib/generators/minitest/scaffold/templates/api_controller_spec.rb +0 -42
- data/lib/generators/minitest/scaffold/templates/api_controller_test.rb +0 -44
- data/lib/generators/minitest/scaffold/templates/controller_spec.rb +0 -52
- data/lib/minitest/rails/constant_lookup.rb +0 -52
- data/lib/minitest/rails/controller.rb +0 -14
- data/minitest-rails.gemspec +0 -48
- data/tasks/test.rake +0 -29
- data/test/generators/test_controller_generator.rb +0 -58
- data/test/generators/test_generator_generator.rb +0 -58
- data/test/generators/test_helper_generator.rb +0 -34
- data/test/generators/test_install_generator.rb +0 -27
- data/test/generators/test_job_generator.rb +0 -45
- data/test/generators/test_mailer_generator.rb +0 -42
- data/test/generators/test_model_generator.rb +0 -80
- data/test/generators/test_scaffold_generator.rb +0 -26
- data/test/helper.rb +0 -93
- data/test/rails/action_dispatch/test_assertions.rb +0 -39
- data/test/rails/action_dispatch/test_expectations.rb +0 -39
- data/test/rails/action_dispatch/test_spec_type.rb +0 -49
- data/test/rails/action_mailer/test_mailers.rb +0 -109
- data/test/rails/action_mailer/test_spec_type.rb +0 -47
- data/test/rails/action_view/test_helpers.rb +0 -73
- data/test/rails/action_view/test_spec_type.rb +0 -58
- data/test/rails/active_job/test_assertions.rb +0 -46
- data/test/rails/active_job/test_expectations.rb +0 -55
- data/test/rails/active_job/test_spec_type.rb +0 -49
- data/test/rails/active_support/test_assertions.rb +0 -31
- data/test/rails/active_support/test_expectations.rb +0 -21
- data/test/rails/active_support/test_spec_type.rb +0 -28
- data/test/rails/generators/test_spec_type.rb +0 -45
- data/test/rails/test_constant_lookup.rb +0 -58
- data/test/test_sanity.rb +0 -7
data/Gemfile
DELETED
data/Manifest.txt
DELETED
|
@@ -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
|
data/README.rdoc
DELETED
|
@@ -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
|
data/gemfiles/5.0.gemfile
DELETED
data/gemfiles/head.gemfile
DELETED
data/lib/generators/.document
DELETED
|
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,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,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 -%>
|