minitest-rails 0.2 → 1.0.0.beta1

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 (96) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +17 -14
  3. data/CHANGELOG.rdoc +66 -0
  4. data/Gemfile +7 -0
  5. data/LICENSE +1 -1
  6. data/Manifest.txt +36 -20
  7. data/README.rdoc +25 -27
  8. data/Rakefile +10 -7
  9. data/gemfiles/3.0.gemfile +2 -6
  10. data/gemfiles/3.1.gemfile +2 -6
  11. data/gemfiles/3.2.gemfile +2 -6
  12. data/gemfiles/4.0.gemfile +4 -0
  13. data/lib/generators/.document +0 -0
  14. data/lib/generators/mini_test/controller/controller_generator.rb +0 -1
  15. data/lib/generators/mini_test/controller/templates/controller_spec.rb +4 -4
  16. data/lib/generators/mini_test/controller/templates/controller_test.rb +6 -6
  17. data/lib/generators/mini_test/helper/helper_generator.rb +0 -2
  18. data/lib/generators/mini_test/helper/templates/helper_spec.rb +1 -1
  19. data/lib/generators/mini_test/helper/templates/helper_test.rb +2 -2
  20. data/lib/generators/mini_test/install/install_generator.rb +6 -1
  21. data/lib/generators/mini_test/install/templates/test_helper.rb +27 -0
  22. data/lib/generators/mini_test/integration/integration_generator.rb +2 -4
  23. data/lib/generators/mini_test/integration/templates/integration_spec.rb +6 -6
  24. data/lib/generators/mini_test/integration/templates/integration_test.rb +5 -5
  25. data/lib/generators/mini_test/mailer/mailer_generator.rb +2 -3
  26. data/lib/generators/mini_test/mailer/templates/mailer_spec.rb +1 -1
  27. data/lib/generators/mini_test/mailer/templates/mailer_test.rb +6 -6
  28. data/lib/generators/mini_test/model/model_generator.rb +3 -4
  29. data/lib/generators/mini_test/model/templates/model_spec.rb +3 -5
  30. data/lib/generators/mini_test/model/templates/model_test.rb +11 -5
  31. data/lib/generators/mini_test/route/route_generator.rb +28 -0
  32. data/lib/generators/mini_test/route/templates/route_spec.rb +10 -0
  33. data/lib/generators/mini_test/route/templates/route_test.rb +10 -0
  34. data/lib/generators/mini_test/scaffold/scaffold_generator.rb +15 -1
  35. data/lib/generators/mini_test/scaffold/templates/controller_spec.rb +14 -16
  36. data/lib/generators/mini_test/scaffold/templates/controller_test.rb +9 -9
  37. data/lib/generators/mini_test.rb +30 -14
  38. data/lib/minitest/rails/assertions.rb +1811 -0
  39. data/lib/minitest/rails/constant_lookup.rb +54 -0
  40. data/lib/minitest/rails/deprecated/action_controller.rb +2 -0
  41. data/lib/minitest/rails/deprecated/action_dispatch.rb +2 -0
  42. data/lib/minitest/rails/deprecated/action_mailer.rb +4 -0
  43. data/lib/minitest/rails/deprecated/action_view.rb +2 -0
  44. data/lib/minitest/rails/deprecated/active_support.rb +2 -0
  45. data/lib/minitest/rails/expectations.rb +659 -0
  46. data/lib/minitest/rails/generators.rb +18 -0
  47. data/lib/minitest/rails/railtie.rb +16 -0
  48. data/lib/minitest/rails/tasks/.document +0 -0
  49. data/lib/minitest/rails/tasks/minitest.rake +69 -54
  50. data/lib/minitest/rails/testing.rb +29 -0
  51. data/lib/minitest/rails/version.rb +5 -0
  52. data/lib/minitest/rails.rb +125 -35
  53. data/lib/minitest-rails.rb +2 -23
  54. data/minitest-rails.gemspec +26 -21
  55. data/tasks/test.rake +38 -0
  56. data/test/generators/test_controller_generator.rb +10 -39
  57. data/test/generators/test_helper_generator.rb +8 -35
  58. data/test/generators/test_install_generator.rb +24 -30
  59. data/test/generators/test_mailer_generator.rb +24 -29
  60. data/test/generators/test_model_generator.rb +31 -32
  61. data/test/generators/test_route_generator.rb +24 -0
  62. data/test/generators/test_scaffold_generator.rb +5 -29
  63. data/test/helper.rb +63 -0
  64. data/test/rails/action_controller/test_assertions.rb +46 -0
  65. data/test/rails/action_controller/test_controllers.rb +5 -26
  66. data/test/rails/action_controller/test_expectations.rb +45 -0
  67. data/test/rails/action_controller/test_spec_type.rb +3 -7
  68. data/test/rails/{test_action_dispatch_spec_type.rb → action_dispatch/test_spec_type.rb} +16 -11
  69. data/test/rails/action_mailer/test_mailers.rb +109 -0
  70. data/test/rails/{test_action_mailer_spec_type.rb → action_mailer/test_spec_type.rb} +3 -8
  71. data/test/rails/action_view/test_helpers.rb +73 -0
  72. data/test/rails/{test_action_view_spec_type.rb → action_view/test_spec_type.rb} +10 -10
  73. data/test/rails/active_support/test_assertions.rb +59 -0
  74. data/test/rails/active_support/test_expectations.rb +49 -0
  75. data/test/rails/{test_active_support_spec_type.rb → active_support/test_spec_type.rb} +2 -7
  76. data/test/rails/generators/test_spec_type.rb +36 -0
  77. data/test/rails/minitest_5_api_test.rb +8 -0
  78. data/test/rails/test_constant_lookup.rb +58 -0
  79. data/test/test_sanity.rb +1 -2
  80. metadata +84 -56
  81. data/gemfiles/3.0.gemfile.lock +0 -92
  82. data/gemfiles/3.1.gemfile.lock +0 -103
  83. data/gemfiles/3.2.gemfile.lock +0 -101
  84. data/lib/autotest/discover.rb +0 -5
  85. data/lib/autotest/fixtures.rb +0 -7
  86. data/lib/autotest/migrate.rb +0 -5
  87. data/lib/autotest/minitest_rails.rb +0 -62
  88. data/lib/generators/mini_test/install/templates/test/minitest_helper.rb +0 -25
  89. data/lib/minitest/rails/action_controller.rb +0 -61
  90. data/lib/minitest/rails/action_dispatch.rb +0 -36
  91. data/lib/minitest/rails/action_mailer.rb +0 -19
  92. data/lib/minitest/rails/action_view.rb +0 -20
  93. data/lib/minitest/rails/active_support.rb +0 -68
  94. data/lib/minitest/rails/declarative.rb +0 -27
  95. data/lib/minitest/rails/mochaing.rb +0 -11
  96. data/test/rails/action_controller/test_controller_lookup.rb +0 -49
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b5f87e7032f8578fdc6543551231f08849a377be
4
+ data.tar.gz: 263f20f6ba31323cdedad548ab6e4690876e5715
5
+ SHA512:
6
+ metadata.gz: 31bdd76b8d6329b0b7f64c5a92e772969a3b2128839b4cd331dd045b0afcbf2dced8f40eaf209ef57e8b00d7e2bdf3cce8c5e24220ce4464b1817d98a4264be8
7
+ data.tar.gz: 44c812ec2e71d3fdeb1d324efd113e043f56d2e0f29ae3a5a17167898eab6def9be5a589371d790ea51017cc02bcf7061ee9c9663fc06e6e5cb9da8d927c2186
data/.travis.yml CHANGED
@@ -1,19 +1,22 @@
1
1
  ---
2
- before_script:
3
- - gem install hoe-travis --no-rdoc --no-ri
4
- - ruby gemfiles/minitest_tu_shim.rb
5
- - rake travis:before -t
2
+ before_install:
3
+ - gem update --system
4
+ - gem --version
5
+ - ruby gemfiles/minitest_tu_shim.rb
6
6
  language: ruby
7
7
  notifications:
8
8
  email:
9
- - mike@blowmage.com
9
+ - mike@blowmage.com
10
10
  rvm:
11
- - 1.9.3
12
- - ruby-head
13
- - 1.8.7
14
- - ree
15
- gemfile:
16
- - gemfiles/3.0.gemfile
17
- - gemfiles/3.1.gemfile
18
- - gemfiles/3.2.gemfile
19
- script: rake travis
11
+ - 2.0.0
12
+ - 1.9.3
13
+ - 1.8.7
14
+ env:
15
+ - "RAILS_VERSION=4.0"
16
+ - "RAILS_VERSION=3.2"
17
+ - "RAILS_VERSION=3.1"
18
+ - "RAILS_VERSION=3.0"
19
+ matrix:
20
+ exclude:
21
+ - rvm: 1.8.7
22
+ env: "RAILS_VERSION=4.0"
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,69 @@
1
+ === 0.9.2 / 2013-04-05
2
+
3
+ * Fix nested describes in ruby 1.8
4
+
5
+ https://github.com/blowmage/minitest-rails/compare/v0.9.1...v0.9.2
6
+
7
+ === 0.9.1 / 2013-03-18
8
+
9
+ * Remove describe method
10
+
11
+ https://github.com/blowmage/minitest-rails/compare/v0.9.0...v0.9.1
12
+
13
+ === 0.9.0 / 2013-03-18
14
+
15
+ This release marks a new direction for minitest-rails. Deprecations have been added for the features that won't make it to 1.0. See instructions for upgrading to 0.9:
16
+
17
+ https://github.com/blowmage/minitest-rails/wiki/Upgrading-to-0.9
18
+
19
+ * 1 major enhancement:
20
+
21
+ * Use newly added MiniTest::Spec::DSL
22
+
23
+ * 2 minor enhancements:
24
+
25
+ * Add deprecation warnings
26
+ * Switch back to the default test helper name, for easier integration in Rails 4.
27
+ * Update Rails 4 Gemfile
28
+
29
+ https://github.com/blowmage/minitest-rails/compare/v0.5.2...v0.9.0
30
+
31
+ === 0.5.2 / 2013-02-21
32
+
33
+ * Allow running of single test file
34
+ * Update README
35
+ * Update install instructions
36
+ * Fix test helper's instructions
37
+
38
+ https://github.com/blowmage/minitest-rails/compare/v0.5.1...v0.5.2
39
+
40
+ === 0.5.1 / 2013-01-24
41
+
42
+ * Add route test generator
43
+ * Several changes in rake tasks
44
+
45
+ https://github.com/blowmage/minitest-rails/compare/v0.5...v0.5.1
46
+
47
+ === 0.5 / 2013-01-11
48
+
49
+ * Add support for Rails 4
50
+ * Use ActiveSupport::TestCase instead of MiniTest::Rails::ActiveSupport::TestCase.
51
+ * Add MiniTest::Rails::Testing
52
+ * Use MiniTest::Rails::Testing.default_tasks instead of MINITEST_TASKS.
53
+
54
+ https://github.com/blowmage/minitest-rails/compare/v0.3...v0.5
55
+
56
+ === 0.3 / 2012-11-02
57
+
58
+ * Mailer lookup for spec-style tests
59
+ * Helper lookup for spec-style tests
60
+ * Scaffold controller test green out of the box
61
+ * Bump minitest dependency version to 4.0
62
+ * Fixed builds in travis
63
+ * Added convenience rake tasks for dealing with gemfiles
64
+
65
+ https://github.com/blowmage/minitest-rails/compare/v0.2...v0.3
66
+
1
67
  === 0.2 / 2012-09-19
2
68
 
3
69
  * Add support for Autotest (closes #64)
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ version = ENV["RAILS_VERSION"] || "4.0"
6
+
7
+ eval_gemfile File.expand_path("../gemfiles/#{version}.gemfile", __FILE__)
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Mike Moore
1
+ Copyright (c) 2013 Mike Moore
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/Manifest.txt CHANGED
@@ -2,21 +2,17 @@
2
2
  .gemtest
3
3
  .travis.yml
4
4
  CHANGELOG.rdoc
5
+ Gemfile
5
6
  LICENSE
6
7
  Manifest.txt
7
8
  README.rdoc
8
9
  Rakefile
9
10
  gemfiles/3.0.gemfile
10
- gemfiles/3.0.gemfile.lock
11
11
  gemfiles/3.1.gemfile
12
- gemfiles/3.1.gemfile.lock
13
12
  gemfiles/3.2.gemfile
14
- gemfiles/3.2.gemfile.lock
13
+ gemfiles/4.0.gemfile
15
14
  gemfiles/minitest_tu_shim.rb
16
- lib/autotest/discover.rb
17
- lib/autotest/fixtures.rb
18
- lib/autotest/migrate.rb
19
- lib/autotest/minitest_rails.rb
15
+ lib/generators/.document
20
16
  lib/generators/mini_test.rb
21
17
  lib/generators/mini_test/controller/controller_generator.rb
22
18
  lib/generators/mini_test/controller/templates/controller_spec.rb
@@ -25,7 +21,7 @@ lib/generators/mini_test/helper/helper_generator.rb
25
21
  lib/generators/mini_test/helper/templates/helper_spec.rb
26
22
  lib/generators/mini_test/helper/templates/helper_test.rb
27
23
  lib/generators/mini_test/install/install_generator.rb
28
- lib/generators/mini_test/install/templates/test/minitest_helper.rb
24
+ lib/generators/mini_test/install/templates/test_helper.rb
29
25
  lib/generators/mini_test/integration/integration_generator.rb
30
26
  lib/generators/mini_test/integration/templates/integration_spec.rb
31
27
  lib/generators/mini_test/integration/templates/integration_test.rb
@@ -36,32 +32,52 @@ lib/generators/mini_test/model/model_generator.rb
36
32
  lib/generators/mini_test/model/templates/fixtures.yml
37
33
  lib/generators/mini_test/model/templates/model_spec.rb
38
34
  lib/generators/mini_test/model/templates/model_test.rb
35
+ lib/generators/mini_test/route/route_generator.rb
36
+ lib/generators/mini_test/route/templates/route_spec.rb
37
+ lib/generators/mini_test/route/templates/route_test.rb
39
38
  lib/generators/mini_test/scaffold/scaffold_generator.rb
40
39
  lib/generators/mini_test/scaffold/templates/controller_spec.rb
41
40
  lib/generators/mini_test/scaffold/templates/controller_test.rb
42
41
  lib/minitest-rails.rb
43
42
  lib/minitest/rails.rb
44
- lib/minitest/rails/action_controller.rb
45
- lib/minitest/rails/action_dispatch.rb
46
- lib/minitest/rails/action_mailer.rb
47
- lib/minitest/rails/action_view.rb
48
- lib/minitest/rails/active_support.rb
49
- lib/minitest/rails/declarative.rb
50
- lib/minitest/rails/mochaing.rb
43
+ lib/minitest/rails/assertions.rb
44
+ lib/minitest/rails/constant_lookup.rb
45
+ lib/minitest/rails/deprecated/action_controller.rb
46
+ lib/minitest/rails/deprecated/action_dispatch.rb
47
+ lib/minitest/rails/deprecated/action_mailer.rb
48
+ lib/minitest/rails/deprecated/action_view.rb
49
+ lib/minitest/rails/deprecated/active_support.rb
50
+ lib/minitest/rails/expectations.rb
51
+ lib/minitest/rails/generators.rb
52
+ lib/minitest/rails/railtie.rb
53
+ lib/minitest/rails/tasks/.document
51
54
  lib/minitest/rails/tasks/minitest.rake
52
55
  lib/minitest/rails/tasks/sub_test_task.rb
56
+ lib/minitest/rails/testing.rb
57
+ lib/minitest/rails/version.rb
53
58
  minitest-rails.gemspec
59
+ tasks/test.rake
54
60
  test/generators/test_controller_generator.rb
55
61
  test/generators/test_helper_generator.rb
56
62
  test/generators/test_install_generator.rb
57
63
  test/generators/test_mailer_generator.rb
58
64
  test/generators/test_model_generator.rb
65
+ test/generators/test_route_generator.rb
59
66
  test/generators/test_scaffold_generator.rb
60
- test/rails/action_controller/test_controller_lookup.rb
67
+ test/helper.rb
68
+ test/rails/action_controller/test_assertions.rb
61
69
  test/rails/action_controller/test_controllers.rb
70
+ test/rails/action_controller/test_expectations.rb
62
71
  test/rails/action_controller/test_spec_type.rb
63
- test/rails/test_action_dispatch_spec_type.rb
64
- test/rails/test_action_mailer_spec_type.rb
65
- test/rails/test_action_view_spec_type.rb
66
- test/rails/test_active_support_spec_type.rb
72
+ test/rails/action_dispatch/test_spec_type.rb
73
+ test/rails/action_mailer/test_mailers.rb
74
+ test/rails/action_mailer/test_spec_type.rb
75
+ test/rails/action_view/test_helpers.rb
76
+ test/rails/action_view/test_spec_type.rb
77
+ test/rails/active_support/test_assertions.rb
78
+ test/rails/active_support/test_expectations.rb
79
+ test/rails/active_support/test_spec_type.rb
80
+ test/rails/generators/test_spec_type.rb
81
+ test/rails/minitest_5_api_test.rb
82
+ test/rails/test_constant_lookup.rb
67
83
  test/test_sanity.rb
data/README.rdoc CHANGED
@@ -1,8 +1,9 @@
1
1
  = minitest-rails
2
2
 
3
- MiniTest integration for Rails 3.x
3
+ MiniTest integration for Rails 3 and 4
4
4
 
5
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]
6
7
 
7
8
  == Install
8
9
 
@@ -18,29 +19,25 @@ Create a new rails app without Test::Unit:
18
19
 
19
20
  rails new MyApp --skip-test-unit
20
21
 
21
- Add <tt>minitest-rails</tt> to the <tt>:test</tt> and <tt>:development</tt> groups in Gemfile:
22
+ Add <tt>minitest-rails</tt> to the Gemfile:
22
23
 
23
- group :test, :development do
24
- gem 'minitest-rails'
25
- end
24
+ gem "minitest-rails"
26
25
 
27
26
  Next run the installation generator with the following:
28
27
 
29
28
  rails generate mini_test:install
30
29
 
31
- This will add the <tt>minitest_helper.rb</tt> file to the <tt>test</tt> directory.
30
+ This will add the <tt>test_helper.rb</tt> file to the <tt>test</tt> directory.
32
31
 
33
32
  == Usage
34
33
 
35
- We aim to expose MiniTest with minimal changes for testing within Rails.
36
- Because of this, we allow Test::Unit and MiniTest tests to live side by side.
37
- Your test classes will inherit from MiniTest::Rails::ActiveSupport::TestCase a opposed to ActiveSupport::TestCase.
38
- You can use the MiniTest::Spec DSL.
34
+ This project aims to enable MiniTest within the Rails TestCase classes.
35
+ Your test will continue to inherit from <tt>ActiveSupport::TestCase</tt>, which will now support the spec DSL.
39
36
  You can generate test files with the standard model, controller, resource, and other generators:
40
37
 
41
38
  rails generate model User
42
39
 
43
- And you can specify generating the tests using the MiniTest::Spec DSL on any of the generators by providing the <tt>--spec</tt> option:
40
+ And you can specify generating the tests using the <tt>MiniTest::Spec</tt> DSL on any of the generators by providing the <tt>--spec</tt> option:
44
41
 
45
42
  rails generate model User --spec
46
43
 
@@ -53,33 +50,34 @@ You can also set these as defaults by adding the following to the <tt>config/app
53
50
  config.generators do |g|
54
51
  g.test_framework :mini_test, :spec => true, :fixture => false
55
52
  end
53
+
54
+ To run your tests, minitest-rails provides multiple rake tasks by default, for a complete list, simply run <tt>rake -T</tt>.
56
55
 
57
- == Overriding Test::Unit
56
+ You can also add any directories under <tt>test/</tt> and minitest-rails will automatically create the associated rake task for it. So let say you add a <tt>test/api/</tt> directory, <tt>rake minitest:api</tt> will automagically be available.
58
57
 
59
- Of course, you may not want to maintain separate Test::Unit and MiniTest tests.
60
- If this is the behavior you are wanting, simply add the following to your <tt>test_helper.rb</tt> file:
58
+ If you want to automatically run <tt>rake minitest:api</tt> when you call <tt>rake minitest</tt>, add this line to a new .rake file under <tt>lib/tasks/</tt>:
61
59
 
62
- require "minitest/rails"
63
- MiniTest::Rails.override_testunit!
60
+ MiniTest::Rails::Testing.default_tasks << 'api'
64
61
 
65
- == Capybara
62
+ == Running on Ruby 1.8
66
63
 
67
- You can use Capybara in your acceptance/integration tests by adding <tt>minitest-rails-capybara</tt> as a dependency.
64
+ Efforts have been made to be compatible with Ruby 1.8.7, but some rough edges may remain. For the latest information on 1.8 compatibility see the wiki: https://github.com/blowmage/minitest-rails/wiki/Running-on-1.8
68
65
 
69
- group :test, :development do
70
- gem 'minitest-rails'
71
- gem 'minitest-rails-capybara'
72
- end
66
+ == Capybara
73
67
 
74
- And add the following to your test helper file:
68
+ 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
75
69
 
76
- require "minitest/rails/capybara"
70
+ == Upgrading
77
71
 
78
- See the <tt>minitest-rails-capybara</tt> project for more information.
72
+ The 0.9 release marks a new direction for minitest-rails. Deprecations have been added for the features that won't make it to 1.0. See instructions for upgrading to 0.9: https://github.com/blowmage/minitest-rails/wiki/Upgrading-to-0.9
79
73
 
80
74
  == Incompatibilities
81
75
 
82
- Existing tests that call <tt>describe</tt> will not work, since <tt>describe</tt> is used by MiniTest::Spec blocks.
76
+ Existing tests that call <tt>describe</tt> will not work, since <tt>describe</tt> is used by <tt>MiniTest::Spec</tt> blocks.
77
+
78
+ RSpec and minitest's spec DSL are incompatible and cannot both be loaded at the same time. If your tests using the spec DSL are not running it is likely the RSpec DSL is also loaded. Check the dependencies and make sure RSpec is only loaded when running the specs.
79
+
80
+ If you need to use some RSpec features with minitest-rails require only the needed gems. e.g. To use RSpec mocks with minitest-rails require the "rspec-mocks" gem only, and not the main "rspec" gem which activates the RSpec DSL.
83
81
 
84
82
  == Get Involved
85
83
 
@@ -89,7 +87,7 @@ https://groups.google.com/group/minitest-rails
89
87
 
90
88
  == License
91
89
 
92
- Copyright (c) 2012 Mike Moore
90
+ Copyright (c) 2013 Mike Moore
93
91
 
94
92
  Permission is hereby granted, free of charge, to any person obtaining
95
93
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -5,23 +5,26 @@ require 'hoe'
5
5
 
6
6
  Hoe.plugin :git
7
7
  Hoe.plugin :gemspec
8
- Hoe.plugin :travis
9
- Hoe.plugins.delete :rubyforge
10
8
 
11
9
  Hoe.spec 'minitest-rails' do
12
10
  developer 'Mike Moore', 'mike@blowmage.com'
13
11
 
14
- self.summary = 'MiniTest integration for Rails 3.x'
15
- self.description = 'Adds MiniTest as the default testing library in Rails 3.x'
12
+ self.summary = 'MiniTest integration for Rails 3 and 4'
13
+ self.description = 'Adds MiniTest as the default testing library in Rails 3 and 4'
16
14
  self.urls = ['http://blowmage.com/minitest-rails']
17
15
 
18
16
  self.history_file = "CHANGELOG.rdoc"
19
17
  self.readme_file = "README.rdoc"
20
18
  self.testlib = :minitest
21
19
 
22
- dependency 'minitest', '~> 3.4'
23
- dependency 'rails', '~> 3.0'
24
- dependency 'fakefs', '~> 0.4', :dev
20
+ license "MIT"
21
+
22
+ dependency 'minitest', '~> 4.7'
23
+ dependency 'minitest-test', '~> 1.0'
24
+ dependency 'railties', '>= 3.0'
25
+ dependency 'fakefs', '~> 0.4', :dev
25
26
  end
26
27
 
28
+ Dir["tasks/**/*.rake"].each { |t| load t }
29
+
27
30
  # vim: syntax=ruby
data/gemfiles/3.0.gemfile CHANGED
@@ -1,9 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "rails", "~> 3.0.15"
4
- gem "minitest", "~> 3.0"
3
+ gem "rails", "~> 3.0.20"
4
+ gem "rake"
5
5
  gem "rdoc", "~> 3.10"
6
- gem "hoe", "~> 3.0"
7
- gem "fakefs", "~> 0.4"
8
-
9
- gemspec :path=>"../"
data/gemfiles/3.1.gemfile CHANGED
@@ -1,9 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "rails", "~> 3.1.6"
4
- gem "minitest", "~> 3.0"
3
+ gem "rails", "~> 3.1.11"
4
+ gem "rake"
5
5
  gem "rdoc", "~> 3.10"
6
- gem "hoe", "~> 3.0"
7
- gem "fakefs", "~> 0.4"
8
-
9
- gemspec :path=>"../"
data/gemfiles/3.2.gemfile CHANGED
@@ -1,9 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "rails", "~> 3.2.6"
4
- gem "minitest", "~> 3.0"
3
+ gem "rails", "~> 3.2.13"
4
+ gem "rake"
5
5
  gem "rdoc", "~> 3.10"
6
- gem "hoe", "~> 3.0"
7
- gem "fakefs", "~> 0.4"
8
-
9
- gemspec :path=>"../"
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rails", "~> 4.0.0"
4
+ gem "rake"
File without changes
@@ -4,7 +4,6 @@ module MiniTest
4
4
  module Generators
5
5
  class ControllerGenerator < Base
6
6
  argument :actions, :type => :array, :default => [], :banner => "action action"
7
- class_option :spec, :type => :boolean, :default => false, :desc => "Use MiniTest::Spec DSL"
8
7
 
9
8
  check_class_collision :suffix => "ControllerTest"
10
9
 
@@ -1,11 +1,11 @@
1
- require "minitest_helper"
1
+ require "test_helper"
2
2
 
3
3
  <% module_namespacing do -%>
4
4
  describe <%= class_name %>Controller do
5
5
  <% if actions.empty? -%>
6
- # it "must be a real test" do
7
- # flunk "Need real tests"
8
- # end
6
+ it "must be a real test" do
7
+ flunk "Need real tests"
8
+ end
9
9
  <% else -%>
10
10
  <% actions.each do |action| -%>
11
11
  it "should get <%= action %>" do
@@ -1,14 +1,14 @@
1
- require "minitest_helper"
1
+ require "test_helper"
2
2
 
3
3
  <% module_namespacing do -%>
4
- class <%= class_name %>ControllerTest < MiniTest::Rails::ActionController::TestCase
4
+ class <%= class_name %>ControllerTest < ActionController::TestCase
5
5
  <% if actions.empty? -%>
6
- # test "the truth" do
7
- # assert true
8
- # end
6
+ def test_sanity
7
+ flunk "Need real tests"
8
+ end
9
9
  <% else -%>
10
10
  <% actions.each do |action| -%>
11
- test "should get <%= action %>" do
11
+ def test_<%= action %>
12
12
  get :<%= action %>
13
13
  assert_response :success
14
14
  end
@@ -3,8 +3,6 @@ require "generators/mini_test"
3
3
  module MiniTest
4
4
  module Generators
5
5
  class HelperGenerator < Base
6
- class_option :spec, :type => :boolean, :default => false, :desc => "Use MiniTest::Spec DSL"
7
-
8
6
  check_class_collision :suffix => "HelperTest"
9
7
 
10
8
  def create_test_files
@@ -1,4 +1,4 @@
1
- require "minitest_helper"
1
+ require "test_helper"
2
2
 
3
3
  describe <%= class_name %>Helper do
4
4
 
@@ -1,7 +1,7 @@
1
- require "minitest_helper"
1
+ require "test_helper"
2
2
 
3
3
  <% module_namespacing do -%>
4
- class <%= class_name %>HelperTest < MiniTest::Rails::ActionView::TestCase
4
+ class <%= class_name %>HelperTest < ActionView::TestCase
5
5
 
6
6
  def test_sanity
7
7
  flunk "Need real tests"
@@ -3,6 +3,7 @@ require 'rails/generators'
3
3
  module MiniTest
4
4
  module Generators
5
5
  class InstallGenerator < ::Rails::Generators::Base
6
+ class_option :active_record, :type => :boolean, :default => true, :desc => "Add ActiveRecord configuration"
6
7
 
7
8
  desc <<DESC
8
9
  Description:
@@ -14,7 +15,11 @@ DESC
14
15
  end
15
16
 
16
17
  def copy_minitest_files
17
- directory 'test'
18
+ template 'test_helper.rb', File.join("test", "test_helper.rb")
19
+ end
20
+
21
+ def add_migration_check
22
+ ::Rails::VERSION::STRING >= "4.0"
18
23
  end
19
24
 
20
25
  end
@@ -0,0 +1,27 @@
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
+ <% if options[:active_record] -%>
15
+ <% if add_migration_check -%>
16
+ ActiveRecord::Migration.check_pending!
17
+
18
+ <% end -%>
19
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
20
+ #
21
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
22
+ # -- they do not yet inherit this setting
23
+ fixtures :all
24
+
25
+ <% end -%>
26
+ # Add more helper methods to be used by all tests here...
27
+ end
@@ -3,15 +3,13 @@ require "generators/mini_test"
3
3
  module MiniTest
4
4
  module Generators
5
5
  class IntegrationGenerator < Base
6
- class_option :spec, :type => :boolean, :default => false, :desc => "Use MiniTest::Spec DSL"
7
-
8
6
  check_class_collision :suffix => "Test"
9
7
 
10
8
  def create_test_files
11
9
  if options[:spec]
12
- template 'integration_spec.rb', File.join('test/acceptance', class_path, "#{file_name}_test.rb")
10
+ template 'integration_spec.rb', File.join('test/integration', class_path, "#{file_name}_test.rb")
13
11
  else
14
- template 'integration_test.rb', File.join('test/acceptance', class_path, "#{file_name}_test.rb")
12
+ template 'integration_test.rb', File.join('test/integration', class_path, "#{file_name}_test.rb")
15
13
  end
16
14
  end
17
15
  end
@@ -1,8 +1,8 @@
1
- require "minitest_helper"
1
+ require "test_helper"
2
2
 
3
- # To be handled correctly this spec must end with "Acceptance Test"
4
- describe "<%= class_name %> Acceptance Test" do
5
- # it "must be a real test" do
6
- # flunk "Need real tests"
7
- # end
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
8
  end
@@ -1,7 +1,7 @@
1
- require "minitest_helper"
1
+ require "test_helper"
2
2
 
3
- class <%= class_name %>Test < MiniTest::Rails::ActionDispatch::IntegrationTest
4
- # test "the truth" do
5
- # assert true
6
- # end
3
+ class <%= class_name %>Test < ActionDispatch::IntegrationTest
4
+ def test_sanity
5
+ flunk "Need real tests"
6
+ end
7
7
  end
@@ -4,15 +4,14 @@ module MiniTest
4
4
  module Generators
5
5
  class MailerGenerator < Base
6
6
  argument :actions, :type => :array, :default => [], :banner => "method method"
7
- class_option :spec, :type => :boolean, :default => false, :desc => "Use MiniTest::Spec DSL"
8
7
 
9
8
  check_class_collision :suffix => "MailerTest"
10
9
 
11
10
  def create_test_files
12
11
  if options[:spec]
13
- template "mailer_spec.rb", "test/mailers/#{file_name}_test.rb"
12
+ template "mailer_spec.rb", File.join("test","mailers", class_path, "#{file_name}_test.rb")
14
13
  else
15
- template "mailer_test.rb", "test/mailers/#{file_name}_test.rb"
14
+ template "mailer_test.rb", File.join("test","mailers", class_path, "#{file_name}_test.rb")
16
15
  end
17
16
  end
18
17
  end
@@ -1,4 +1,4 @@
1
- require "minitest_helper"
1
+ require "test_helper"
2
2
 
3
3
  <% module_namespacing do -%>
4
4
  describe <%= class_name %> do
@@ -1,9 +1,9 @@
1
- require "minitest_helper"
1
+ require "test_helper"
2
2
 
3
3
  <% module_namespacing do -%>
4
- class <%= class_name %>Test < MiniTest::Rails::ActionMailer::TestCase
4
+ class <%= class_name %>Test < ActionMailer::TestCase
5
5
  <% actions.each do |action| -%>
6
- test "<%= action %>" do
6
+ def test_<%= action %>
7
7
  mail = <%= class_name %>.<%= action %>
8
8
  assert_equal <%= action.to_s.humanize.inspect %>, mail.subject
9
9
  assert_equal ["to@example.org"], mail.to
@@ -13,9 +13,9 @@ class <%= class_name %>Test < MiniTest::Rails::ActionMailer::TestCase
13
13
 
14
14
  <% end -%>
15
15
  <% if actions.blank? -%>
16
- # test "the truth" do
17
- # assert true
18
- # end
16
+ def test_sanity
17
+ flunk "Need real tests"
18
+ end
19
19
  <% end -%>
20
20
  end
21
21
  <% end -%>