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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 921cfaa469ddecc9a13aa20c02dc2fd9bffa5eafa5bf605713604d95b0e1b9b1
|
|
4
|
+
data.tar.gz: c431d89abcec70990467b4f756f2fdbf2d057df7c9e1ebb717bb08100e3bc936
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bff8982d4743945a7795de1db69a27e3335fa4406b3a83d16ad6b6654005efdd6412982c093d3d7cfab366b045d03def59e00d411aa42717e85cf89cf0783db6
|
|
7
|
+
data.tar.gz: 6960f3757941914a3667c3f6e588305c3622f05a646216c4da5904ee4794f549fe32caf4e3d088e9ae33fe41ddc7d8a7d4b84fd6cb5cf0a7e7b04d20fa59a336
|
data/LICENSE
CHANGED
data/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# minitest-rails
|
|
2
|
+
|
|
3
|
+
Minitest integration for Rails 5.0
|
|
4
|
+
|
|
5
|
+
[](http://travis-ci.org/blowmage/minitest-rails)
|
|
6
|
+
[](https://codeclimate.com/github/blowmage/minitest-rails)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
`gem install minitest-rails`
|
|
11
|
+
|
|
12
|
+
This installs the following gems:
|
|
13
|
+
|
|
14
|
+
* `minitest`
|
|
15
|
+
|
|
16
|
+
## Configure
|
|
17
|
+
|
|
18
|
+
Create a new rails app:
|
|
19
|
+
|
|
20
|
+
`rails new MyApp`
|
|
21
|
+
|
|
22
|
+
### Update Gemfile
|
|
23
|
+
|
|
24
|
+
This version is for Rails 5.0 applications. Update your application to use the
|
|
25
|
+
gem by adding the following to your Gemfile:
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
gem "minitest-rails", "~> 5.0.0"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Installing
|
|
32
|
+
|
|
33
|
+
Next run the installation generator with the following:
|
|
34
|
+
|
|
35
|
+
`rails generate minitest:install`
|
|
36
|
+
|
|
37
|
+
This will add the `test_helper.rb` file to the `test` directory.
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
This project aims to enable Minitest within the Rails TestCase classes.
|
|
42
|
+
Your test will continue to inherit from `ActiveSupport::TestCase`, which will now support the spec DSL.
|
|
43
|
+
You can generate test files using the `Minitest::Spec` DSL with the standard model, controller, resource, and other generators:
|
|
44
|
+
|
|
45
|
+
`rails generate model User`
|
|
46
|
+
|
|
47
|
+
And you can specify generating the tests without the `Minitest::Spec` DSL on any of the generators by providing the `--no-spec` option:
|
|
48
|
+
|
|
49
|
+
`rails generate model User --no-spec`
|
|
50
|
+
|
|
51
|
+
And you can specify not generating the fixture for a model by providing the `--skip-fixture` option:
|
|
52
|
+
|
|
53
|
+
`rails generate model User --skip-fixture`
|
|
54
|
+
|
|
55
|
+
You can also set these as defaults by adding the following to the `config/application.rb` file:
|
|
56
|
+
|
|
57
|
+
```ruby
|
|
58
|
+
config.generators do |g|
|
|
59
|
+
g.test_framework :minitest, spec: false, fixture: false
|
|
60
|
+
end
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Running Tests
|
|
64
|
+
|
|
65
|
+
To run your tests use the `rails test` that ship with rails.
|
|
66
|
+
|
|
67
|
+
## Get Involved
|
|
68
|
+
|
|
69
|
+
Join the mailing list to get help or offer suggestions.
|
|
70
|
+
|
|
71
|
+
https://groups.google.com/group/minitest-rails
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
Copyright (c) 2019 Mike Moore
|
|
76
|
+
|
|
77
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
78
|
+
a copy of this software and associated documentation files (the
|
|
79
|
+
"Software"), to deal in the Software without restriction, including
|
|
80
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
81
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
82
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
83
|
+
the following conditions:
|
|
84
|
+
|
|
85
|
+
The above copyright notice and this permission notice shall be
|
|
86
|
+
included in all copies or substantial portions of the Software.
|
|
87
|
+
|
|
88
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
89
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
90
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
91
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
92
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
93
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
94
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/UPDATING.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Updating from previous versions
|
|
2
|
+
|
|
3
|
+
If you are upgrading from previous versions, then there are some subtle changes that you should be aware of. Do you see a change that is not listed in this document? Then please [open an issue](https://github.com/blowmage/minitest-rails/issues/new) to add it.
|
|
4
|
+
|
|
5
|
+
## Spec DSL
|
|
6
|
+
|
|
7
|
+
The `describe` block should be passed the actual constant and not a string of the constant's name. This works:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
describe WidgetsController do
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
But this does not:
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
describe "WidgetsController" do
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
If you want to pass a string, then you must provide an additional description to tell the Spec DSL what test class to use:
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
describe "WidgetsController", :controller do
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Expectations
|
|
26
|
+
|
|
27
|
+
The signature for the expectation `must_change` has changed from earlier versions of minitest-rails. This is because the expectation used to refer to the `assert_difference` assertion, but not refers to the `assert_changes` assertion added in Rails 5.1. The expectation for the `assert_difference` assertion is now `must_differ`.
|
|
28
|
+
|
|
29
|
+
## Versioning
|
|
30
|
+
|
|
31
|
+
The minitest-rails gem now follows Rails versioning. This means minitest-rails 6.0.x works for rails 6.0.x, and minitest-rails 6.1.x will work for rails 6.1.x.
|
data/lib/generators/minitest.rb
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rails/generators/named_base"
|
|
2
4
|
|
|
3
5
|
module Minitest
|
|
4
6
|
module Generators
|
|
5
7
|
class Base < ::Rails::Generators::NamedBase #:nodoc:
|
|
6
8
|
class_option :spec, type: :boolean, default: true,
|
|
7
9
|
desc: "Use Minitest::Spec DSL"
|
|
10
|
+
class_option :spec_expectation_monad, type: :string, default: "value",
|
|
11
|
+
desc: "Spec DSL's expectation value mondad (options: value, expect, _)"
|
|
8
12
|
|
|
9
13
|
def self.default_source_root
|
|
10
|
-
File.expand_path(File.join(File.dirname(__FILE__),
|
|
14
|
+
File.expand_path(File.join(File.dirname(__FILE__), "minitest", generator_name, "templates"))
|
|
11
15
|
end
|
|
12
16
|
|
|
13
|
-
def
|
|
14
|
-
"
|
|
17
|
+
def test_file_type
|
|
18
|
+
return "spec" if options[:spec]
|
|
19
|
+
|
|
20
|
+
"test"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def spec_expectation_monad
|
|
24
|
+
monad = options[:spec_expectation_monad]
|
|
25
|
+
return monad if %w[value expect _].include? monad
|
|
26
|
+
|
|
27
|
+
"value"
|
|
15
28
|
end
|
|
16
29
|
end
|
|
17
30
|
end
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "generators/minitest"
|
|
2
4
|
|
|
3
|
-
module Minitest
|
|
4
|
-
module Generators
|
|
5
|
-
class ControllerGenerator < Base
|
|
5
|
+
module Minitest # :nodoc:
|
|
6
|
+
module Generators # :nodoc:
|
|
7
|
+
class ControllerGenerator < Base # :nodoc:
|
|
6
8
|
argument :actions, type: :array, default: [], banner: "action action"
|
|
7
9
|
check_class_collision suffix: "ControllerTest"
|
|
8
10
|
|
|
9
11
|
def create_test_files
|
|
10
|
-
|
|
11
|
-
template_file = "controller_spec.rb"
|
|
12
|
-
else
|
|
13
|
-
template_file = "controller_test.rb"
|
|
14
|
-
end
|
|
15
|
-
template template_file,
|
|
12
|
+
template "functional_#{test_file_type}.rb",
|
|
16
13
|
File.join("test/controllers", class_path, "#{file_name}_controller_test.rb")
|
|
17
14
|
end
|
|
18
15
|
end
|
data/lib/generators/minitest/controller/templates/{controller_spec.rb → functional_spec.rb.tt}
RENAMED
|
@@ -7,14 +7,14 @@ describe <%= class_name %>Controller do
|
|
|
7
7
|
|
|
8
8
|
<% end -%>
|
|
9
9
|
<% if actions.empty? -%>
|
|
10
|
-
# it "
|
|
11
|
-
#
|
|
10
|
+
# it "does a thing" do
|
|
11
|
+
# <%= spec_expectation_monad %>(1+1).must_equal 2
|
|
12
12
|
# end
|
|
13
13
|
<% else -%>
|
|
14
14
|
<% actions.each do |action| -%>
|
|
15
|
-
it "
|
|
15
|
+
it "must get <%= action %>" do
|
|
16
16
|
get <%= url_helper_prefix %>_<%= action %>_url
|
|
17
|
-
|
|
17
|
+
must_respond_with :success
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
<% end -%>
|
data/lib/generators/minitest/controller/templates/{controller_test.rb → functional_test.rb.tt}
RENAMED
|
@@ -7,12 +7,12 @@ class <%= class_name %>ControllerTest < ActionDispatch::IntegrationTest
|
|
|
7
7
|
|
|
8
8
|
<% end -%>
|
|
9
9
|
<% if actions.empty? -%>
|
|
10
|
-
# def
|
|
11
|
-
#
|
|
10
|
+
# def test_truth
|
|
11
|
+
# assert true
|
|
12
12
|
# end
|
|
13
13
|
<% else -%>
|
|
14
14
|
<% actions.each do |action| -%>
|
|
15
|
-
def
|
|
15
|
+
def test_get_<%= action %>
|
|
16
16
|
get <%= url_helper_prefix %>_<%= action %>_url
|
|
17
17
|
assert_response :success
|
|
18
18
|
end
|
|
@@ -2,22 +2,17 @@ require "generators/minitest"
|
|
|
2
2
|
|
|
3
3
|
module Minitest
|
|
4
4
|
module Generators
|
|
5
|
-
class GeneratorGenerator < Base
|
|
5
|
+
class GeneratorGenerator < Base # :nodoc:
|
|
6
6
|
check_class_collision suffix: "GeneratorTest"
|
|
7
7
|
|
|
8
8
|
class_option :namespace, type: :boolean, default: true,
|
|
9
9
|
desc: "Namespace generator under lib/generators/name"
|
|
10
10
|
|
|
11
11
|
def create_generator_files
|
|
12
|
-
|
|
13
|
-
template_file = "generator_spec.rb"
|
|
14
|
-
else
|
|
15
|
-
template_file = "generator_test.rb"
|
|
16
|
-
end
|
|
17
|
-
template template_file, File.join("test/lib/generators", class_path, "#{file_name}_generator_test.rb")
|
|
12
|
+
template "generator_#{test_file_type}.rb", File.join("test/lib/generators", class_path, "#{file_name}_generator_test.rb")
|
|
18
13
|
end
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
private
|
|
21
16
|
|
|
22
17
|
def generator_path
|
|
23
18
|
if options[:namespace]
|
|
@@ -3,11 +3,11 @@ require "<%= generator_path %>"
|
|
|
3
3
|
|
|
4
4
|
<% module_namespacing do -%>
|
|
5
5
|
describe <%= class_name %>Generator do
|
|
6
|
+
#tests <%= class_name %>Generator
|
|
6
7
|
destination Rails.root.join("tmp/generators")
|
|
7
8
|
setup :prepare_destination
|
|
8
9
|
|
|
9
|
-
# it "
|
|
10
|
-
# # No error raised? It passes.
|
|
10
|
+
# it "runs without errors" do
|
|
11
11
|
# run_generator ["arguments"]
|
|
12
12
|
# end
|
|
13
13
|
end
|
|
@@ -7,8 +7,7 @@ class <%= class_name %>GeneratorTest < Rails::Generators::TestCase
|
|
|
7
7
|
destination Rails.root.join("tmp/generators")
|
|
8
8
|
setup :prepare_destination
|
|
9
9
|
|
|
10
|
-
# def
|
|
11
|
-
# # No error raised? It passes.
|
|
10
|
+
# def test_generator_runs_without_errors
|
|
12
11
|
# run_generator ["arguments"]
|
|
13
12
|
# end
|
|
14
13
|
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 HelperGenerator < Base
|
|
5
|
+
module Minitest # :nodoc:
|
|
6
|
+
module Generators # :nodoc:
|
|
7
|
+
class HelperGenerator < Base # :nodoc:
|
|
6
8
|
# Rails does not generate anything here.
|
|
7
9
|
end
|
|
8
10
|
end
|
|
@@ -1,21 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rails/generators"
|
|
4
|
+
require "rails/generators/app_base"
|
|
2
5
|
|
|
3
6
|
module Minitest
|
|
4
7
|
module Generators
|
|
5
|
-
class InstallGenerator < ::Rails::Generators::
|
|
8
|
+
class InstallGenerator < ::Rails::Generators::AppBase
|
|
6
9
|
class_option :skip_active_record, type: :boolean, default: false, desc: "Skip Active Record files"
|
|
7
10
|
|
|
8
|
-
desc
|
|
9
|
-
Description:
|
|
10
|
-
|
|
11
|
-
DESC
|
|
11
|
+
desc <<~DESC
|
|
12
|
+
Description:
|
|
13
|
+
Copy minitest files to your application.
|
|
14
|
+
DESC
|
|
12
15
|
|
|
13
16
|
def self.source_root
|
|
14
|
-
@source_root ||= File.expand_path(File.join(File.dirname(__FILE__),
|
|
17
|
+
@source_root ||= File.expand_path(File.join(File.dirname(__FILE__), "templates"))
|
|
15
18
|
end
|
|
16
19
|
|
|
17
20
|
def copy_minitest_files
|
|
18
|
-
|
|
21
|
+
empty_directory_with_keep_file "test/fixtures"
|
|
22
|
+
empty_directory_with_keep_file "test/fixtures/files"
|
|
23
|
+
empty_directory_with_keep_file "test/controllers"
|
|
24
|
+
empty_directory_with_keep_file "test/mailers"
|
|
25
|
+
empty_directory_with_keep_file "test/models"
|
|
26
|
+
empty_directory_with_keep_file "test/helpers"
|
|
27
|
+
empty_directory_with_keep_file "test/integration"
|
|
28
|
+
|
|
29
|
+
template "test/test_helper.rb"
|
|
19
30
|
end
|
|
20
31
|
end
|
|
21
32
|
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
ENV["RAILS_ENV"] ||= "test"
|
|
2
|
+
require_relative "../config/environment"
|
|
3
|
+
require "rails/test_help"
|
|
4
|
+
require "minitest/rails"
|
|
5
|
+
|
|
6
|
+
# Consider setting MT_NO_EXPECTATIONS to not add expectations to Object.
|
|
7
|
+
# ENV["MT_NO_EXPECTATIONS"] = true
|
|
8
|
+
|
|
9
|
+
class ActiveSupport::TestCase
|
|
10
|
+
<% unless options[:skip_active_record] -%>
|
|
11
|
+
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
|
12
|
+
fixtures :all
|
|
13
|
+
|
|
14
|
+
<% end -%>
|
|
15
|
+
# Add more helper methods to be used by all tests here...
|
|
16
|
+
end
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "generators/minitest"
|
|
2
4
|
|
|
3
|
-
module Minitest
|
|
4
|
-
module Generators
|
|
5
|
-
class IntegrationGenerator < Base
|
|
5
|
+
module Minitest # :nodoc:
|
|
6
|
+
module Generators # :nodoc:
|
|
7
|
+
class IntegrationGenerator < Base # :nodoc:
|
|
6
8
|
check_class_collision suffix: "Test"
|
|
7
9
|
|
|
8
10
|
def create_test_files
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
template "integration_#{test_file_type}.rb", File.join("test/integration", class_path, "#{file_name}_test.rb")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def file_name
|
|
17
|
+
@_file_name ||= super.sub(/_test\z/i, "")
|
|
15
18
|
end
|
|
16
19
|
end
|
|
17
20
|
end
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "generators/minitest"
|
|
2
4
|
|
|
3
|
-
module Minitest
|
|
4
|
-
module Generators
|
|
5
|
-
class JobGenerator < Base
|
|
5
|
+
module Minitest # :nodoc:
|
|
6
|
+
module Generators # :nodoc:
|
|
7
|
+
class JobGenerator < Base # :nodoc:
|
|
6
8
|
check_class_collision suffix: "JobTest"
|
|
7
9
|
|
|
8
|
-
def
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
def create_test_file
|
|
11
|
+
template "unit_#{test_file_type}.rb", File.join("test/jobs", class_path, "#{file_name}_job_test.rb")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def file_name
|
|
17
|
+
@_file_name ||= super.sub(/_job\z/i, "")
|
|
15
18
|
end
|
|
16
19
|
end
|
|
17
20
|
end
|