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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +8 -6
  3. data/CHANGELOG.rdoc +0 -6
  4. data/Gemfile +1 -1
  5. data/Manifest.txt +6 -13
  6. data/Rakefile +4 -3
  7. data/gemfiles/5.0.gemfile +5 -0
  8. data/gemfiles/head.gemfile +5 -0
  9. data/lib/generators/minitest/controller/templates/controller_spec.rb +9 -5
  10. data/lib/generators/minitest/controller/templates/controller_test.rb +9 -5
  11. data/lib/generators/minitest/generator/generator_generator.rb +2 -3
  12. data/lib/generators/minitest/generator/templates/generator_spec.rb +1 -1
  13. data/lib/generators/minitest/generator/templates/generator_test.rb +1 -1
  14. data/lib/generators/minitest/helper/helper_generator.rb +1 -11
  15. data/lib/generators/minitest/integration/integration_generator.rb +1 -2
  16. data/lib/generators/minitest/integration/templates/integration_spec.rb +3 -3
  17. data/lib/generators/minitest/integration/templates/integration_test.rb +3 -3
  18. data/lib/generators/minitest/job/job_generator.rb +2 -3
  19. data/lib/generators/minitest/job/templates/job_spec.rb +3 -3
  20. data/lib/generators/minitest/job/templates/job_test.rb +3 -3
  21. data/lib/generators/minitest/mailer/mailer_generator.rb +9 -4
  22. data/lib/generators/minitest/mailer/templates/mailer_spec.rb +4 -4
  23. data/lib/generators/minitest/mailer/templates/mailer_test.rb +5 -5
  24. data/lib/generators/minitest/mailer/templates/preview.rb +5 -5
  25. data/lib/generators/minitest/model/model_generator.rb +3 -4
  26. data/lib/generators/minitest/model/templates/fixtures.yml +17 -12
  27. data/lib/generators/minitest/scaffold/scaffold_generator.rb +24 -3
  28. data/lib/generators/minitest/scaffold/templates/api_controller_spec.rb +42 -0
  29. data/lib/generators/minitest/scaffold/templates/api_controller_test.rb +44 -0
  30. data/lib/generators/minitest/scaffold/templates/controller_spec.rb +14 -11
  31. data/lib/generators/minitest/scaffold/templates/controller_test.rb +17 -14
  32. data/lib/minitest/rails.rb +10 -27
  33. data/lib/minitest/rails/assertions.rb +0 -561
  34. data/lib/minitest/rails/expectations.rb +0 -63
  35. data/lib/minitest/rails/version.rb +1 -1
  36. data/minitest-rails.gemspec +13 -10
  37. data/tasks/test.rake +8 -8
  38. data/test/generators/test_helper_generator.rb +8 -16
  39. data/test/generators/test_mailer_generator.rb +16 -17
  40. data/test/generators/test_model_generator.rb +1 -1
  41. data/test/generators/test_scaffold_generator.rb +2 -2
  42. data/test/helper.rb +16 -1
  43. data/test/rails/{action_controller → action_dispatch}/test_assertions.rb +4 -11
  44. data/test/rails/{action_controller → action_dispatch}/test_expectations.rb +4 -11
  45. data/test/rails/action_dispatch/test_spec_type.rb +6 -18
  46. data/test/rails/action_mailer/test_mailers.rb +6 -6
  47. data/test/rails/action_view/test_helpers.rb +2 -2
  48. metadata +28 -21
  49. data/gemfiles/4.1.gemfile +0 -5
  50. data/gemfiles/4.2.gemfile +0 -5
  51. data/lib/generators/minitest/helper/templates/helper_spec.rb +0 -9
  52. data/lib/generators/minitest/helper/templates/helper_test.rb +0 -9
  53. data/lib/generators/minitest/route/route_generator.rb +0 -28
  54. data/lib/generators/minitest/route/templates/route_spec.rb +0 -13
  55. data/lib/generators/minitest/route/templates/route_test.rb +0 -13
  56. data/test/generators/test_route_generator.rb +0 -24
  57. data/test/rails/action_controller/test_controllers.rb +0 -202
  58. data/test/rails/action_controller/test_spec_type.rb +0 -47
  59. 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: b9a0575b74e31e8c8be87b70924d2d21c4a937ff
4
- data.tar.gz: f88ee78502a3451ac3fcba1f02ab24fea16cb64f
3
+ metadata.gz: 2688d8c89f8d51e4741631acb4405cbdce0d4b3f
4
+ data.tar.gz: 72969593b7e65122627b2e4287aff919d605a1d2
5
5
  SHA512:
6
- metadata.gz: 98e4864bb5d0d06bd41c1ff147d57f075689d7de04a4ae9b961214523a7eb0d55606dec61b787d870b0469503c1e53b473fc650d54b59a65b0a4469c25cd7b34
7
- data.tar.gz: 2bf40731369b63900624e8853d7599db02f6822eda32b28ad820516ab3884026986103f9c0268ba6722fab62da40c1da20a93b6129750a06896b011fd93372a0
6
+ metadata.gz: 3bf3b58bec282d666d52d12148a529e24006a4ff640546d8ca526d5367850ce6dc5dc90da3daf1e375c99e9b576981be45d50f0e1f550c30ec9645f9c78371b5
7
+ data.tar.gz: 7f135465d0b16375cfb4bd9085b2669836e90c438c63b3ddd80bd0011ec6515527cdfdfeba03b2a7b60371b5c8c06e14aa95edb35e7e2ff67d945e9175cbdee8
@@ -7,13 +7,15 @@ notifications:
7
7
  email:
8
8
  - mike@blowmage.com
9
9
  rvm:
10
- - 2.2
11
- - 2.1
12
- - 2.0
13
- - 1.9.3
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=4.1"
16
- - "RAILS_VERSION=4.2"
17
+ - "RAILS_VERSION=5.0"
18
+ - "RAILS_VERSION=head"
17
19
  notifications:
18
20
  webhooks:
19
21
  urls:
@@ -1,9 +1,3 @@
1
- === 2.2.1 / 2016-05-07
2
-
3
- * Fix missing docs and aliases methods on ActionView::TestCase and
4
- ActionDispatch::IntegrationTest
5
- * Fix link to fixtures documentation (trosborn)
6
-
7
1
  === 2.2.0 / 2015-05-29
8
2
 
9
3
  * Update to Minitest 5.7
data/Gemfile CHANGED
@@ -2,6 +2,6 @@ source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- version = ENV["RAILS_VERSION"] || "4.2"
5
+ version = ENV["RAILS_VERSION"] || "5.0"
6
6
 
7
7
  eval_gemfile File.expand_path("../gemfiles/#{version}.gemfile", __FILE__)
@@ -7,8 +7,8 @@ LICENSE
7
7
  Manifest.txt
8
8
  README.rdoc
9
9
  Rakefile
10
- gemfiles/4.1.gemfile
11
- gemfiles/4.2.gemfile
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/action_controller/test_assertions.rb
65
- test/rails/action_controller/test_controllers.rb
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", "~> 5.7"
23
- dependency "railties", "~> 4.1"
24
- dependency "fakefs", "= 0.4.3", :dev
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 }
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org" do
2
+ gem "rails", "~> 5.0.0.rc1"
3
+ gem "sqlite3"
4
+ gem "rake"
5
+ end
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org" do
2
+ gem "rails", github: "rails/rails"
3
+ gem "sqlite3"
4
+ gem "rake"
5
+ end
@@ -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
- flunk "Need real tests"
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 :<%= action %>
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 < ActionController::TestCase
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
- flunk "Need real tests"
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 :<%= action %>
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
@@ -11,4 +11,4 @@ describe <%= class_name %>Generator do
11
11
  # run_generator ["arguments"]
12
12
  # end
13
13
  end
14
- <% end -%>
14
+ <% end -%>
@@ -12,4 +12,4 @@ class <%= class_name %>GeneratorTest < Rails::Generators::TestCase
12
12
  # run_generator ["arguments"]
13
13
  # end
14
14
  end
15
- <% end -%>
15
+ <% end -%>
@@ -3,17 +3,7 @@ require "generators/minitest"
3
3
  module Minitest
4
4
  module Generators
5
5
  class HelperGenerator < Base
6
- check_class_collision suffix: "HelperTest"
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
- flunk "Need real tests"
7
- end
5
+ # it "must be a real test" do
6
+ # flunk "Need real tests"
7
+ # end
8
8
  end
@@ -1,7 +1,7 @@
1
1
  require "test_helper"
2
2
 
3
3
  class <%= class_name %>Test < ActionDispatch::IntegrationTest
4
- def test_sanity
5
- flunk "Need real tests"
6
- end
4
+ # def test_sanity
5
+ # flunk "Need real tests"
6
+ # end
7
7
  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: 'JobTest'
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
@@ -2,8 +2,8 @@ require "test_helper"
2
2
 
3
3
  <% module_namespacing do -%>
4
4
  describe <%= class_name %>Job do
5
- it "must be a real test" do
6
- flunk "Need real tests"
7
- end
5
+ # it "must be a real test" do
6
+ # flunk "Need real tests"
7
+ # end
8
8
  end
9
9
  <% end -%>
@@ -2,8 +2,8 @@ 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"
7
- end
5
+ # def test_sanity
6
+ # flunk "Need real tests"
7
+ # end
8
8
  end
9
9
  <% 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}Test", "#{class_name}Preview"
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}_preview.rb")
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
- flunk "Need real tests"
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 %>Test < ActionMailer::TestCase
4
+ class <%= class_name %>MailerTest < ActionMailer::TestCase
5
5
  <% actions.each do |action| -%>
6
6
  def test_<%= action %>
7
- mail = <%= class_name %>.<%= action %>
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
- flunk "Need real tests"
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 %>Preview < ActionMailer::Preview
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 %>/<%= action %>
6
+ # Preview this email at http://localhost:3000/rails/mailers/<%= file_path %>_mailer/<%= action %>
7
7
  def <%= action %>
8
- <%= class_name %>.<%= action %>
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, desc: "Create fixture file"
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, "#{plural_file_name}.yml")
26
+ template "fixtures.yml", File.join("test/fixtures", class_path, "#{fixture_file_name}.yml")
28
27
  end
29
28
  end
30
29