minitest-rails 2.2.1 → 3.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -6
- data/CHANGELOG.rdoc +0 -6
- data/Gemfile +1 -1
- data/Manifest.txt +6 -13
- data/Rakefile +4 -3
- data/gemfiles/5.0.gemfile +5 -0
- data/gemfiles/head.gemfile +5 -0
- data/lib/generators/minitest/controller/templates/controller_spec.rb +9 -5
- data/lib/generators/minitest/controller/templates/controller_test.rb +9 -5
- data/lib/generators/minitest/generator/generator_generator.rb +2 -3
- data/lib/generators/minitest/generator/templates/generator_spec.rb +1 -1
- data/lib/generators/minitest/generator/templates/generator_test.rb +1 -1
- data/lib/generators/minitest/helper/helper_generator.rb +1 -11
- data/lib/generators/minitest/integration/integration_generator.rb +1 -2
- data/lib/generators/minitest/integration/templates/integration_spec.rb +3 -3
- data/lib/generators/minitest/integration/templates/integration_test.rb +3 -3
- data/lib/generators/minitest/job/job_generator.rb +2 -3
- data/lib/generators/minitest/job/templates/job_spec.rb +3 -3
- data/lib/generators/minitest/job/templates/job_test.rb +3 -3
- data/lib/generators/minitest/mailer/mailer_generator.rb +9 -4
- data/lib/generators/minitest/mailer/templates/mailer_spec.rb +4 -4
- data/lib/generators/minitest/mailer/templates/mailer_test.rb +5 -5
- data/lib/generators/minitest/mailer/templates/preview.rb +5 -5
- data/lib/generators/minitest/model/model_generator.rb +3 -4
- data/lib/generators/minitest/model/templates/fixtures.yml +17 -12
- data/lib/generators/minitest/scaffold/scaffold_generator.rb +24 -3
- data/lib/generators/minitest/scaffold/templates/api_controller_spec.rb +42 -0
- data/lib/generators/minitest/scaffold/templates/api_controller_test.rb +44 -0
- data/lib/generators/minitest/scaffold/templates/controller_spec.rb +14 -11
- data/lib/generators/minitest/scaffold/templates/controller_test.rb +17 -14
- data/lib/minitest/rails.rb +10 -27
- data/lib/minitest/rails/assertions.rb +0 -561
- data/lib/minitest/rails/expectations.rb +0 -63
- data/lib/minitest/rails/version.rb +1 -1
- data/minitest-rails.gemspec +13 -10
- data/tasks/test.rake +8 -8
- data/test/generators/test_helper_generator.rb +8 -16
- data/test/generators/test_mailer_generator.rb +16 -17
- data/test/generators/test_model_generator.rb +1 -1
- data/test/generators/test_scaffold_generator.rb +2 -2
- data/test/helper.rb +16 -1
- data/test/rails/{action_controller → action_dispatch}/test_assertions.rb +4 -11
- data/test/rails/{action_controller → action_dispatch}/test_expectations.rb +4 -11
- data/test/rails/action_dispatch/test_spec_type.rb +6 -18
- data/test/rails/action_mailer/test_mailers.rb +6 -6
- data/test/rails/action_view/test_helpers.rb +2 -2
- metadata +28 -21
- data/gemfiles/4.1.gemfile +0 -5
- data/gemfiles/4.2.gemfile +0 -5
- data/lib/generators/minitest/helper/templates/helper_spec.rb +0 -9
- data/lib/generators/minitest/helper/templates/helper_test.rb +0 -9
- data/lib/generators/minitest/route/route_generator.rb +0 -28
- data/lib/generators/minitest/route/templates/route_spec.rb +0 -13
- data/lib/generators/minitest/route/templates/route_test.rb +0 -13
- data/test/generators/test_route_generator.rb +0 -24
- data/test/rails/action_controller/test_controllers.rb +0 -202
- data/test/rails/action_controller/test_spec_type.rb +0 -47
- data/test/rails/minitest_5_api_test.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2688d8c89f8d51e4741631acb4405cbdce0d4b3f
|
4
|
+
data.tar.gz: 72969593b7e65122627b2e4287aff919d605a1d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bf3b58bec282d666d52d12148a529e24006a4ff640546d8ca526d5367850ce6dc5dc90da3daf1e375c99e9b576981be45d50f0e1f550c30ec9645f9c78371b5
|
7
|
+
data.tar.gz: 7f135465d0b16375cfb4bd9085b2669836e90c438c63b3ddd80bd0011ec6515527cdfdfeba03b2a7b60371b5c8c06e14aa95edb35e7e2ff67d945e9175cbdee8
|
data/.travis.yml
CHANGED
@@ -7,13 +7,15 @@ notifications:
|
|
7
7
|
email:
|
8
8
|
- mike@blowmage.com
|
9
9
|
rvm:
|
10
|
-
- 2.
|
11
|
-
- 2.
|
12
|
-
- 2.
|
13
|
-
-
|
10
|
+
- 2.3.1
|
11
|
+
- 2.3.0
|
12
|
+
- 2.2.4
|
13
|
+
- 2.2.3
|
14
|
+
- 2.2.2
|
15
|
+
- head
|
14
16
|
env:
|
15
|
-
- "RAILS_VERSION=
|
16
|
-
- "RAILS_VERSION=
|
17
|
+
- "RAILS_VERSION=5.0"
|
18
|
+
- "RAILS_VERSION=head"
|
17
19
|
notifications:
|
18
20
|
webhooks:
|
19
21
|
urls:
|
data/CHANGELOG.rdoc
CHANGED
data/Gemfile
CHANGED
data/Manifest.txt
CHANGED
@@ -7,8 +7,8 @@ LICENSE
|
|
7
7
|
Manifest.txt
|
8
8
|
README.rdoc
|
9
9
|
Rakefile
|
10
|
-
gemfiles/
|
11
|
-
gemfiles/
|
10
|
+
gemfiles/5.0.gemfile
|
11
|
+
gemfiles/head.gemfile
|
12
12
|
lib/generators/.document
|
13
13
|
lib/generators/minitest.rb
|
14
14
|
lib/generators/minitest/controller/controller_generator.rb
|
@@ -18,8 +18,6 @@ lib/generators/minitest/generator/generator_generator.rb
|
|
18
18
|
lib/generators/minitest/generator/templates/generator_spec.rb
|
19
19
|
lib/generators/minitest/generator/templates/generator_test.rb
|
20
20
|
lib/generators/minitest/helper/helper_generator.rb
|
21
|
-
lib/generators/minitest/helper/templates/helper_spec.rb
|
22
|
-
lib/generators/minitest/helper/templates/helper_test.rb
|
23
21
|
lib/generators/minitest/install/install_generator.rb
|
24
22
|
lib/generators/minitest/install/templates/test_helper.rb
|
25
23
|
lib/generators/minitest/integration/integration_generator.rb
|
@@ -36,10 +34,9 @@ lib/generators/minitest/model/model_generator.rb
|
|
36
34
|
lib/generators/minitest/model/templates/fixtures.yml
|
37
35
|
lib/generators/minitest/model/templates/model_spec.rb
|
38
36
|
lib/generators/minitest/model/templates/model_test.rb
|
39
|
-
lib/generators/minitest/route/route_generator.rb
|
40
|
-
lib/generators/minitest/route/templates/route_spec.rb
|
41
|
-
lib/generators/minitest/route/templates/route_test.rb
|
42
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
|
43
40
|
lib/generators/minitest/scaffold/templates/controller_spec.rb
|
44
41
|
lib/generators/minitest/scaffold/templates/controller_test.rb
|
45
42
|
lib/minitest-rails.rb
|
@@ -58,13 +55,10 @@ test/generators/test_install_generator.rb
|
|
58
55
|
test/generators/test_job_generator.rb
|
59
56
|
test/generators/test_mailer_generator.rb
|
60
57
|
test/generators/test_model_generator.rb
|
61
|
-
test/generators/test_route_generator.rb
|
62
58
|
test/generators/test_scaffold_generator.rb
|
63
59
|
test/helper.rb
|
64
|
-
test/rails/
|
65
|
-
test/rails/
|
66
|
-
test/rails/action_controller/test_expectations.rb
|
67
|
-
test/rails/action_controller/test_spec_type.rb
|
60
|
+
test/rails/action_dispatch/test_assertions.rb
|
61
|
+
test/rails/action_dispatch/test_expectations.rb
|
68
62
|
test/rails/action_dispatch/test_spec_type.rb
|
69
63
|
test/rails/action_mailer/test_mailers.rb
|
70
64
|
test/rails/action_mailer/test_spec_type.rb
|
@@ -77,6 +71,5 @@ test/rails/active_support/test_assertions.rb
|
|
77
71
|
test/rails/active_support/test_expectations.rb
|
78
72
|
test/rails/active_support/test_spec_type.rb
|
79
73
|
test/rails/generators/test_spec_type.rb
|
80
|
-
test/rails/minitest_5_api_test.rb
|
81
74
|
test/rails/test_constant_lookup.rb
|
82
75
|
test/test_sanity.rb
|
data/Rakefile
CHANGED
@@ -19,9 +19,10 @@ Hoe.spec "minitest-rails" do
|
|
19
19
|
|
20
20
|
license "MIT"
|
21
21
|
|
22
|
-
dependency "minitest",
|
23
|
-
dependency "railties",
|
24
|
-
dependency "fakefs",
|
22
|
+
dependency "minitest", "~> 5.8"
|
23
|
+
dependency "railties", "~> 5.0.0.rc1"
|
24
|
+
dependency "fakefs", "= 0.4.3", :dev
|
25
|
+
dependency "minitest-focus", "~> 1.1", :dev
|
25
26
|
end
|
26
27
|
|
27
28
|
Dir["tasks/**/*.rake"].each { |t| load t }
|
@@ -2,18 +2,22 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
<% module_namespacing do -%>
|
4
4
|
describe <%= class_name %>Controller do
|
5
|
+
<% if mountable_engine? -%>
|
6
|
+
include Engine.routes.url_helpers
|
7
|
+
|
8
|
+
<% end -%>
|
5
9
|
<% if actions.empty? -%>
|
6
|
-
it "must be a real test" do
|
7
|
-
|
8
|
-
end
|
10
|
+
# it "must be a real test" do
|
11
|
+
# flunk "Need real tests"
|
12
|
+
# end
|
9
13
|
<% else -%>
|
10
14
|
<% actions.each do |action| -%>
|
11
15
|
it "should get <%= action %>" do
|
12
|
-
get
|
16
|
+
get <%= url_helper_prefix %>_<%= action %>_url
|
13
17
|
value(response).must_be :success?
|
14
18
|
end
|
15
19
|
|
16
20
|
<% end -%>
|
17
21
|
<% end -%>
|
18
22
|
end
|
19
|
-
<% end -%>
|
23
|
+
<% end -%>
|
@@ -1,15 +1,19 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
3
|
<% module_namespacing do -%>
|
4
|
-
class <%= class_name %>ControllerTest <
|
4
|
+
class <%= class_name %>ControllerTest < ActionDispatch::IntegrationTest
|
5
|
+
<% if mountable_engine? -%>
|
6
|
+
include Engine.routes.url_helpers
|
7
|
+
|
8
|
+
<% end -%>
|
5
9
|
<% if actions.empty? -%>
|
6
|
-
def test_sanity
|
7
|
-
|
8
|
-
end
|
10
|
+
# def test_sanity
|
11
|
+
# flunk "Need real tests"
|
12
|
+
# end
|
9
13
|
<% else -%>
|
10
14
|
<% actions.each do |action| -%>
|
11
15
|
def test_<%= action %>
|
12
|
-
get
|
16
|
+
get <%= url_helper_prefix %>_<%= action %>_url
|
13
17
|
assert_response :success
|
14
18
|
end
|
15
19
|
|
@@ -14,8 +14,7 @@ module Minitest
|
|
14
14
|
else
|
15
15
|
template_file = "generator_test.rb"
|
16
16
|
end
|
17
|
-
template template_file,
|
18
|
-
File.join("test/lib/generators", class_path, "#{file_name}_generator_test.rb")
|
17
|
+
template template_file, File.join("test/lib/generators", class_path, "#{file_name}_generator_test.rb")
|
19
18
|
end
|
20
19
|
|
21
20
|
protected
|
@@ -29,4 +28,4 @@ module Minitest
|
|
29
28
|
end
|
30
29
|
end
|
31
30
|
end
|
32
|
-
end
|
31
|
+
end
|
@@ -3,17 +3,7 @@ require "generators/minitest"
|
|
3
3
|
module Minitest
|
4
4
|
module Generators
|
5
5
|
class HelperGenerator < Base
|
6
|
-
|
7
|
-
|
8
|
-
def create_helper_files
|
9
|
-
if options[:spec]
|
10
|
-
template_file = "helper_spec.rb"
|
11
|
-
else
|
12
|
-
template_file = "helper_test.rb"
|
13
|
-
end
|
14
|
-
template template_file,
|
15
|
-
File.join("test/helpers", class_path, "#{file_name}_helper_test.rb")
|
16
|
-
end
|
6
|
+
# Rails does not generate anything here.
|
17
7
|
end
|
18
8
|
end
|
19
9
|
end
|
@@ -11,8 +11,7 @@ module Minitest
|
|
11
11
|
else
|
12
12
|
template_file = "integration_test.rb"
|
13
13
|
end
|
14
|
-
template template_file,
|
15
|
-
File.join("test/integration", class_path, "#{file_name}_test.rb")
|
14
|
+
template template_file, File.join("test/integration", class_path, "#{file_name}_test.rb")
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
@@ -2,7 +2,7 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
# To be handled correctly this spec must end with "Integration Test"
|
4
4
|
describe "<%= class_name %> Integration Test" do
|
5
|
-
it "must be a real test" do
|
6
|
-
|
7
|
-
end
|
5
|
+
# it "must be a real test" do
|
6
|
+
# flunk "Need real tests"
|
7
|
+
# end
|
8
8
|
end
|
@@ -3,7 +3,7 @@ require "generators/minitest"
|
|
3
3
|
module Minitest
|
4
4
|
module Generators
|
5
5
|
class JobGenerator < Base
|
6
|
-
check_class_collision suffix:
|
6
|
+
check_class_collision suffix: "JobTest"
|
7
7
|
|
8
8
|
def create_test_files
|
9
9
|
if options[:spec]
|
@@ -11,8 +11,7 @@ module Minitest
|
|
11
11
|
else
|
12
12
|
template_file = "job_test.rb"
|
13
13
|
end
|
14
|
-
template template_file,
|
15
|
-
File.join("test/jobs", class_path, "#{file_name}_job_test.rb")
|
14
|
+
template template_file, File.join("test/jobs", class_path, "#{file_name}_job_test.rb")
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
@@ -6,7 +6,7 @@ module Minitest
|
|
6
6
|
argument :actions, type: :array, default: [], banner: "method method"
|
7
7
|
|
8
8
|
def check_class_collision
|
9
|
-
class_collisions "#{class_name}
|
9
|
+
class_collisions "#{class_name}MailerTest", "#{class_name}MailerPreview"
|
10
10
|
end
|
11
11
|
|
12
12
|
def create_test_files
|
@@ -15,12 +15,17 @@ module Minitest
|
|
15
15
|
else
|
16
16
|
template_file = "mailer_test.rb"
|
17
17
|
end
|
18
|
-
template template_file,
|
19
|
-
File.join("test/mailers", class_path, "#{file_name}_test.rb")
|
18
|
+
template template_file, File.join("test/mailers", class_path, "#{file_name}_mailer_test.rb")
|
20
19
|
end
|
21
20
|
|
22
21
|
def create_preview_files
|
23
|
-
template "preview.rb", File.join("test/mailers/previews", class_path, "#{file_name}
|
22
|
+
template "preview.rb", File.join("test/mailers/previews", class_path, "#{file_name}_mailer_preview.rb")
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
def file_name
|
28
|
+
@_file_name ||= super.gsub(/_mailer/i, "")
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
3
|
<% module_namespacing do -%>
|
4
|
-
describe <%= class_name %> do
|
4
|
+
describe <%= class_name %>Mailer do
|
5
5
|
<% actions.each do |action| -%>
|
6
6
|
it "<%= action %>" do
|
7
7
|
mail = <%= class_name %>.<%= action %>
|
@@ -12,9 +12,9 @@ describe <%= class_name %> do
|
|
12
12
|
end
|
13
13
|
<% end -%>
|
14
14
|
<% if actions.blank? -%>
|
15
|
-
it "must be a real test" do
|
16
|
-
|
17
|
-
end
|
15
|
+
# it "must be a real test" do
|
16
|
+
# flunk "Need real tests"
|
17
|
+
# end
|
18
18
|
<% end -%>
|
19
19
|
end
|
20
20
|
<% end -%>
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
3
|
<% module_namespacing do -%>
|
4
|
-
class <%= class_name %>
|
4
|
+
class <%= class_name %>MailerTest < ActionMailer::TestCase
|
5
5
|
<% actions.each do |action| -%>
|
6
6
|
def test_<%= action %>
|
7
|
-
mail = <%= class_name
|
7
|
+
mail = <%= class_name %>Mailer.<%= action %>
|
8
8
|
assert_equal <%= action.to_s.humanize.inspect %>, mail.subject
|
9
9
|
assert_equal ["to@example.org"], mail.to
|
10
10
|
assert_equal ["from@example.com"], mail.from
|
@@ -13,9 +13,9 @@ class <%= class_name %>Test < ActionMailer::TestCase
|
|
13
13
|
|
14
14
|
<% end -%>
|
15
15
|
<% if actions.blank? -%>
|
16
|
-
def test_sanity
|
17
|
-
|
18
|
-
end
|
16
|
+
# def test_sanity
|
17
|
+
# flunk "Need real tests"
|
18
|
+
# end
|
19
19
|
<% end -%>
|
20
20
|
end
|
21
21
|
<% end -%>
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
|
-
# Preview all emails at http://localhost:3000/rails/mailers/<%= file_path %>
|
3
|
-
class <%= class_name %>
|
2
|
+
# Preview all emails at http://localhost:3000/rails/mailers/<%= file_path %>_mailer
|
3
|
+
class <%= class_name %>MailerPreview < ActionMailer::Preview
|
4
4
|
<% actions.each do |action| -%>
|
5
5
|
|
6
|
-
# Preview this email at http://localhost:3000/rails/mailers/<%= file_path
|
6
|
+
# Preview this email at http://localhost:3000/rails/mailers/<%= file_path %>_mailer/<%= action %>
|
7
7
|
def <%= action %>
|
8
|
-
<%= class_name
|
8
|
+
<%= class_name %>Mailer.<%= action %>
|
9
9
|
end
|
10
10
|
<% end -%>
|
11
11
|
|
12
12
|
end
|
13
|
-
<% end -%>
|
13
|
+
<% end -%>
|
@@ -6,7 +6,7 @@ module Minitest
|
|
6
6
|
RESERVED_YAML_KEYWORDS = %w(y yes n no true false on off null)
|
7
7
|
|
8
8
|
argument :attributes, type: :array, default: [], banner: "field:type field:type"
|
9
|
-
class_option :fixture, type: :boolean, default: true,
|
9
|
+
class_option :fixture, type: :boolean, default: true, desc: "Create fixture file"
|
10
10
|
|
11
11
|
check_class_collision suffix: "Test"
|
12
12
|
|
@@ -16,15 +16,14 @@ module Minitest
|
|
16
16
|
else
|
17
17
|
template_file = "model_test.rb"
|
18
18
|
end
|
19
|
-
template template_file,
|
20
|
-
File.join("test/models", class_path, "#{file_name}_test.rb")
|
19
|
+
template template_file, File.join("test/models", class_path, "#{file_name}_test.rb")
|
21
20
|
end
|
22
21
|
|
23
22
|
hook_for :fixture_replacement
|
24
23
|
|
25
24
|
def create_fixture_file
|
26
25
|
if options[:fixture] && options[:fixture_replacement].nil?
|
27
|
-
template "fixtures.yml", File.join("test/fixtures", class_path, "#{
|
26
|
+
template "fixtures.yml", File.join("test/fixtures", class_path, "#{fixture_file_name}.yml")
|
28
27
|
end
|
29
28
|
end
|
30
29
|
|