minitest-rails 0.1.1 → 0.2

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 (41) hide show
  1. data/.travis.yml +19 -0
  2. data/CHANGELOG.rdoc +33 -1
  3. data/Manifest.txt +26 -7
  4. data/README.rdoc +22 -3
  5. data/Rakefile +4 -2
  6. data/gemfiles/3.0.gemfile +9 -0
  7. data/gemfiles/3.0.gemfile.lock +92 -0
  8. data/gemfiles/3.1.gemfile +9 -0
  9. data/gemfiles/3.1.gemfile.lock +103 -0
  10. data/gemfiles/3.2.gemfile +9 -0
  11. data/gemfiles/3.2.gemfile.lock +101 -0
  12. data/gemfiles/minitest_tu_shim.rb +4 -0
  13. data/lib/autotest/discover.rb +5 -0
  14. data/lib/autotest/fixtures.rb +7 -0
  15. data/lib/autotest/migrate.rb +5 -0
  16. data/lib/autotest/minitest_rails.rb +62 -0
  17. data/lib/generators/mini_test.rb +11 -3
  18. data/lib/minitest/rails/action_controller.rb +43 -1
  19. data/lib/minitest/rails/action_dispatch.rb +6 -6
  20. data/lib/minitest/rails/action_mailer.rb +3 -1
  21. data/lib/minitest/rails/action_view.rb +7 -5
  22. data/lib/minitest/rails/active_support.rb +5 -1
  23. data/lib/minitest/rails/tasks/minitest.rake +6 -0
  24. data/lib/minitest/rails.rb +2 -2
  25. data/lib/minitest-rails.rb +1 -1
  26. data/minitest-rails.gemspec +10 -7
  27. data/test/{test_controller_generator.rb → generators/test_controller_generator.rb} +34 -27
  28. data/test/{test_helper_generator.rb → generators/test_helper_generator.rb} +29 -24
  29. data/test/{test_install_generator.rb → generators/test_install_generator.rb} +20 -9
  30. data/test/{test_mailer_generator.rb → generators/test_mailer_generator.rb} +23 -14
  31. data/test/{test_model_generator.rb → generators/test_model_generator.rb} +27 -25
  32. data/test/{test_scaffold_generator.rb → generators/test_scaffold_generator.rb} +23 -14
  33. data/test/rails/action_controller/test_controller_lookup.rb +49 -0
  34. data/test/rails/action_controller/test_controllers.rb +223 -0
  35. data/test/rails/action_controller/test_spec_type.rb +41 -0
  36. data/test/rails/test_action_dispatch_spec_type.rb +48 -0
  37. data/test/rails/test_action_mailer_spec_type.rb +42 -0
  38. data/test/rails/test_action_view_spec_type.rb +42 -0
  39. data/test/rails/test_active_support_spec_type.rb +27 -0
  40. metadata +60 -18
  41. /data/test/{test_minitest.rb → test_sanity.rb} +0 -0
data/.travis.yml ADDED
@@ -0,0 +1,19 @@
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
6
+ language: ruby
7
+ notifications:
8
+ email:
9
+ - mike@blowmage.com
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
data/CHANGELOG.rdoc CHANGED
@@ -1,4 +1,36 @@
1
- === 0.1.0 / 2012-07-09
1
+ === 0.2 / 2012-09-19
2
+
3
+ * Add support for Autotest (closes #64)
4
+ * Override default rake task (closes #67)
5
+ * Add support for matching view specs names (closes #70)
6
+ * Fixed travis builds (closes #69)
7
+ * Fix bug with registering AS:TestCase (closes #73)
8
+
9
+ https://github.com/blowmage/minitest-rails/compare/v0.1.3...v0.2
10
+
11
+ === 0.1.3 / 2012-08-02
12
+
13
+ * Significant improvements to nested describe blocks (closes #58)
14
+ * Tests no longer need write permission to the filesystem
15
+
16
+ https://github.com/blowmage/minitest-rails/compare/v0.1.2...v0.1.3
17
+
18
+ === 0.1.2 / 2012-07-26
19
+
20
+ * Fix bug when ActionMailer isn't loaded (closes #66)
21
+ * Allow specs to use strings in `describe` blocks
22
+
23
+ https://github.com/blowmage/minitest-rails/compare/v0.1.1...v0.1.2
24
+
25
+ === 0.1.1 / 2012-07-17
26
+
27
+ * Improved rake tasks
28
+ * Improved Rails 3.0 support
29
+ * Fixed bug with nested describes
30
+
31
+ https://github.com/blowmage/minitest-rails/compare/v0.1...v0.1.1
32
+
33
+ === 0.1 / 2012-07-09
2
34
 
3
35
  This is a major change. The approach used is the same approach used in Rails 4. This version is very different than the 0.0.x versions.
4
36
 
data/Manifest.txt CHANGED
@@ -1,10 +1,22 @@
1
1
  .autotest
2
2
  .gemtest
3
+ .travis.yml
3
4
  CHANGELOG.rdoc
4
5
  LICENSE
5
6
  Manifest.txt
6
7
  README.rdoc
7
8
  Rakefile
9
+ gemfiles/3.0.gemfile
10
+ gemfiles/3.0.gemfile.lock
11
+ gemfiles/3.1.gemfile
12
+ gemfiles/3.1.gemfile.lock
13
+ gemfiles/3.2.gemfile
14
+ gemfiles/3.2.gemfile.lock
15
+ 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
8
20
  lib/generators/mini_test.rb
9
21
  lib/generators/mini_test/controller/controller_generator.rb
10
22
  lib/generators/mini_test/controller/templates/controller_spec.rb
@@ -39,10 +51,17 @@ lib/minitest/rails/mochaing.rb
39
51
  lib/minitest/rails/tasks/minitest.rake
40
52
  lib/minitest/rails/tasks/sub_test_task.rb
41
53
  minitest-rails.gemspec
42
- test/test_controller_generator.rb
43
- test/test_helper_generator.rb
44
- test/test_install_generator.rb
45
- test/test_mailer_generator.rb
46
- test/test_minitest.rb
47
- test/test_model_generator.rb
48
- test/test_scaffold_generator.rb
54
+ test/generators/test_controller_generator.rb
55
+ test/generators/test_helper_generator.rb
56
+ test/generators/test_install_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/rails/action_controller/test_controller_lookup.rb
61
+ test/rails/action_controller/test_controllers.rb
62
+ 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
67
+ test/test_sanity.rb
data/README.rdoc CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  MiniTest integration for Rails 3.x
4
4
 
5
+ {<img src="https://secure.travis-ci.org/blowmage/minitest-rails.png" alt="Build Status" />}[http://travis-ci.org/blowmage/minitest-rails]
6
+
5
7
  == Install
6
8
 
7
9
  gem install minitest-rails
@@ -87,6 +89,23 @@ https://groups.google.com/group/minitest-rails
87
89
 
88
90
  == License
89
91
 
90
- Copyright © 2012 Mike Moore.
91
-
92
- Released under the MIT license. See `LICENSE` for details.
92
+ Copyright (c) 2012 Mike Moore
93
+
94
+ Permission is hereby granted, free of charge, to any person obtaining
95
+ a copy of this software and associated documentation files (the
96
+ "Software"), to deal in the Software without restriction, including
97
+ without limitation the rights to use, copy, modify, merge, publish,
98
+ distribute, sublicense, and/or sell copies of the Software, and to
99
+ permit persons to whom the Software is furnished to do so, subject to
100
+ the following conditions:
101
+
102
+ The above copyright notice and this permission notice shall be
103
+ included in all copies or substantial portions of the Software.
104
+
105
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
106
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
107
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
108
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
109
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
110
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
111
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -5,6 +5,7 @@ require 'hoe'
5
5
 
6
6
  Hoe.plugin :git
7
7
  Hoe.plugin :gemspec
8
+ Hoe.plugin :travis
8
9
  Hoe.plugins.delete :rubyforge
9
10
 
10
11
  Hoe.spec 'minitest-rails' do
@@ -18,8 +19,9 @@ Hoe.spec 'minitest-rails' do
18
19
  self.readme_file = "README.rdoc"
19
20
  self.testlib = :minitest
20
21
 
21
- extra_deps << ['minitest', '~> 3.0']
22
- extra_deps << ['rails', '~> 3.0']
22
+ dependency 'minitest', '~> 3.4'
23
+ dependency 'rails', '~> 3.0'
24
+ dependency 'fakefs', '~> 0.4', :dev
23
25
  end
24
26
 
25
27
  # vim: syntax=ruby
@@ -0,0 +1,9 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rails", "~> 3.0.15"
4
+ gem "minitest", "~> 3.0"
5
+ gem "rdoc", "~> 3.10"
6
+ gem "hoe", "~> 3.0"
7
+ gem "fakefs", "~> 0.4"
8
+
9
+ gemspec :path=>"../"
@@ -0,0 +1,92 @@
1
+ PATH
2
+ remote: /Users/blowmage/codez/minitest-rails
3
+ specs:
4
+ minitest-rails (0.1.2.20120728124510)
5
+ minitest (~> 3.0)
6
+ rails (~> 3.0)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ abstract (1.0.0)
12
+ actionmailer (3.0.16)
13
+ actionpack (= 3.0.16)
14
+ mail (~> 2.2.19)
15
+ actionpack (3.0.16)
16
+ activemodel (= 3.0.16)
17
+ activesupport (= 3.0.16)
18
+ builder (~> 2.1.2)
19
+ erubis (~> 2.6.6)
20
+ i18n (~> 0.5.0)
21
+ rack (~> 1.2.5)
22
+ rack-mount (~> 0.6.14)
23
+ rack-test (~> 0.5.7)
24
+ tzinfo (~> 0.3.23)
25
+ activemodel (3.0.16)
26
+ activesupport (= 3.0.16)
27
+ builder (~> 2.1.2)
28
+ i18n (~> 0.5.0)
29
+ activerecord (3.0.16)
30
+ activemodel (= 3.0.16)
31
+ activesupport (= 3.0.16)
32
+ arel (~> 2.0.10)
33
+ tzinfo (~> 0.3.23)
34
+ activeresource (3.0.16)
35
+ activemodel (= 3.0.16)
36
+ activesupport (= 3.0.16)
37
+ activesupport (3.0.16)
38
+ arel (2.0.10)
39
+ builder (2.1.2)
40
+ erubis (2.6.6)
41
+ abstract (>= 1.0.0)
42
+ fakefs (0.4.0)
43
+ hoe (3.0.6)
44
+ rake (~> 0.8)
45
+ i18n (0.5.0)
46
+ json (1.7.4)
47
+ mail (2.2.19)
48
+ activesupport (>= 2.3.6)
49
+ i18n (>= 0.4.0)
50
+ mime-types (~> 1.16)
51
+ treetop (~> 1.4.8)
52
+ mime-types (1.19)
53
+ minitest (3.3.0)
54
+ polyglot (0.3.3)
55
+ rack (1.2.5)
56
+ rack-mount (0.6.14)
57
+ rack (>= 1.0.0)
58
+ rack-test (0.5.7)
59
+ rack (>= 1.0)
60
+ rails (3.0.16)
61
+ actionmailer (= 3.0.16)
62
+ actionpack (= 3.0.16)
63
+ activerecord (= 3.0.16)
64
+ activeresource (= 3.0.16)
65
+ activesupport (= 3.0.16)
66
+ bundler (~> 1.0)
67
+ railties (= 3.0.16)
68
+ railties (3.0.16)
69
+ actionpack (= 3.0.16)
70
+ activesupport (= 3.0.16)
71
+ rake (>= 0.8.7)
72
+ rdoc (~> 3.4)
73
+ thor (~> 0.14.4)
74
+ rake (0.9.2.2)
75
+ rdoc (3.12)
76
+ json (~> 1.4)
77
+ thor (0.14.6)
78
+ treetop (1.4.10)
79
+ polyglot
80
+ polyglot (>= 0.3.1)
81
+ tzinfo (0.3.33)
82
+
83
+ PLATFORMS
84
+ ruby
85
+
86
+ DEPENDENCIES
87
+ fakefs (~> 0.4)
88
+ hoe (~> 3.0)
89
+ minitest (~> 3.0)
90
+ minitest-rails!
91
+ rails (~> 3.0.15)
92
+ rdoc (~> 3.10)
@@ -0,0 +1,9 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rails", "~> 3.1.6"
4
+ gem "minitest", "~> 3.0"
5
+ gem "rdoc", "~> 3.10"
6
+ gem "hoe", "~> 3.0"
7
+ gem "fakefs", "~> 0.4"
8
+
9
+ gemspec :path=>"../"
@@ -0,0 +1,103 @@
1
+ PATH
2
+ remote: /Users/blowmage/codez/minitest-rails
3
+ specs:
4
+ minitest-rails (0.1.2.20120728124510)
5
+ minitest (~> 3.0)
6
+ rails (~> 3.0)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ actionmailer (3.1.7)
12
+ actionpack (= 3.1.7)
13
+ mail (~> 2.3.3)
14
+ actionpack (3.1.7)
15
+ activemodel (= 3.1.7)
16
+ activesupport (= 3.1.7)
17
+ builder (~> 3.0.0)
18
+ erubis (~> 2.7.0)
19
+ i18n (~> 0.6)
20
+ rack (~> 1.3.6)
21
+ rack-cache (~> 1.2)
22
+ rack-mount (~> 0.8.2)
23
+ rack-test (~> 0.6.1)
24
+ sprockets (~> 2.0.4)
25
+ activemodel (3.1.7)
26
+ activesupport (= 3.1.7)
27
+ builder (~> 3.0.0)
28
+ i18n (~> 0.6)
29
+ activerecord (3.1.7)
30
+ activemodel (= 3.1.7)
31
+ activesupport (= 3.1.7)
32
+ arel (~> 2.2.3)
33
+ tzinfo (~> 0.3.29)
34
+ activeresource (3.1.7)
35
+ activemodel (= 3.1.7)
36
+ activesupport (= 3.1.7)
37
+ activesupport (3.1.7)
38
+ multi_json (>= 1.0, < 1.3)
39
+ arel (2.2.3)
40
+ builder (3.0.0)
41
+ erubis (2.7.0)
42
+ fakefs (0.4.0)
43
+ hike (1.2.1)
44
+ hoe (3.0.6)
45
+ rake (~> 0.8)
46
+ i18n (0.6.0)
47
+ json (1.7.4)
48
+ mail (2.3.3)
49
+ i18n (>= 0.4.0)
50
+ mime-types (~> 1.16)
51
+ treetop (~> 1.4.8)
52
+ mime-types (1.19)
53
+ minitest (3.3.0)
54
+ multi_json (1.2.0)
55
+ polyglot (0.3.3)
56
+ rack (1.3.6)
57
+ rack-cache (1.2)
58
+ rack (>= 0.4)
59
+ rack-mount (0.8.3)
60
+ rack (>= 1.0.0)
61
+ rack-ssl (1.3.2)
62
+ rack
63
+ rack-test (0.6.1)
64
+ rack (>= 1.0)
65
+ rails (3.1.7)
66
+ actionmailer (= 3.1.7)
67
+ actionpack (= 3.1.7)
68
+ activerecord (= 3.1.7)
69
+ activeresource (= 3.1.7)
70
+ activesupport (= 3.1.7)
71
+ bundler (~> 1.0)
72
+ railties (= 3.1.7)
73
+ railties (3.1.7)
74
+ actionpack (= 3.1.7)
75
+ activesupport (= 3.1.7)
76
+ rack-ssl (~> 1.3.2)
77
+ rake (>= 0.8.7)
78
+ rdoc (~> 3.4)
79
+ thor (~> 0.14.6)
80
+ rake (0.9.2.2)
81
+ rdoc (3.12)
82
+ json (~> 1.4)
83
+ sprockets (2.0.4)
84
+ hike (~> 1.2)
85
+ rack (~> 1.0)
86
+ tilt (~> 1.1, != 1.3.0)
87
+ thor (0.14.6)
88
+ tilt (1.3.3)
89
+ treetop (1.4.10)
90
+ polyglot
91
+ polyglot (>= 0.3.1)
92
+ tzinfo (0.3.33)
93
+
94
+ PLATFORMS
95
+ ruby
96
+
97
+ DEPENDENCIES
98
+ fakefs (~> 0.4)
99
+ hoe (~> 3.0)
100
+ minitest (~> 3.0)
101
+ minitest-rails!
102
+ rails (~> 3.1.6)
103
+ rdoc (~> 3.10)
@@ -0,0 +1,9 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rails", "~> 3.2.6"
4
+ gem "minitest", "~> 3.0"
5
+ gem "rdoc", "~> 3.10"
6
+ gem "hoe", "~> 3.0"
7
+ gem "fakefs", "~> 0.4"
8
+
9
+ gemspec :path=>"../"
@@ -0,0 +1,101 @@
1
+ PATH
2
+ remote: /Users/blowmage/codez/minitest-rails
3
+ specs:
4
+ minitest-rails (0.1.2.20120728124510)
5
+ minitest (~> 3.0)
6
+ rails (~> 3.0)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ actionmailer (3.2.7)
12
+ actionpack (= 3.2.7)
13
+ mail (~> 2.4.4)
14
+ actionpack (3.2.7)
15
+ activemodel (= 3.2.7)
16
+ activesupport (= 3.2.7)
17
+ builder (~> 3.0.0)
18
+ erubis (~> 2.7.0)
19
+ journey (~> 1.0.4)
20
+ rack (~> 1.4.0)
21
+ rack-cache (~> 1.2)
22
+ rack-test (~> 0.6.1)
23
+ sprockets (~> 2.1.3)
24
+ activemodel (3.2.7)
25
+ activesupport (= 3.2.7)
26
+ builder (~> 3.0.0)
27
+ activerecord (3.2.7)
28
+ activemodel (= 3.2.7)
29
+ activesupport (= 3.2.7)
30
+ arel (~> 3.0.2)
31
+ tzinfo (~> 0.3.29)
32
+ activeresource (3.2.7)
33
+ activemodel (= 3.2.7)
34
+ activesupport (= 3.2.7)
35
+ activesupport (3.2.7)
36
+ i18n (~> 0.6)
37
+ multi_json (~> 1.0)
38
+ arel (3.0.2)
39
+ builder (3.0.0)
40
+ erubis (2.7.0)
41
+ fakefs (0.4.0)
42
+ hike (1.2.1)
43
+ hoe (3.0.6)
44
+ rake (~> 0.8)
45
+ i18n (0.6.0)
46
+ journey (1.0.4)
47
+ json (1.7.4)
48
+ mail (2.4.4)
49
+ i18n (>= 0.4.0)
50
+ mime-types (~> 1.16)
51
+ treetop (~> 1.4.8)
52
+ mime-types (1.19)
53
+ minitest (3.3.0)
54
+ multi_json (1.3.6)
55
+ polyglot (0.3.3)
56
+ rack (1.4.1)
57
+ rack-cache (1.2)
58
+ rack (>= 0.4)
59
+ rack-ssl (1.3.2)
60
+ rack
61
+ rack-test (0.6.1)
62
+ rack (>= 1.0)
63
+ rails (3.2.7)
64
+ actionmailer (= 3.2.7)
65
+ actionpack (= 3.2.7)
66
+ activerecord (= 3.2.7)
67
+ activeresource (= 3.2.7)
68
+ activesupport (= 3.2.7)
69
+ bundler (~> 1.0)
70
+ railties (= 3.2.7)
71
+ railties (3.2.7)
72
+ actionpack (= 3.2.7)
73
+ activesupport (= 3.2.7)
74
+ rack-ssl (~> 1.3.2)
75
+ rake (>= 0.8.7)
76
+ rdoc (~> 3.4)
77
+ thor (>= 0.14.6, < 2.0)
78
+ rake (0.9.2.2)
79
+ rdoc (3.12)
80
+ json (~> 1.4)
81
+ sprockets (2.1.3)
82
+ hike (~> 1.2)
83
+ rack (~> 1.0)
84
+ tilt (~> 1.1, != 1.3.0)
85
+ thor (0.15.4)
86
+ tilt (1.3.3)
87
+ treetop (1.4.10)
88
+ polyglot
89
+ polyglot (>= 0.3.1)
90
+ tzinfo (0.3.33)
91
+
92
+ PLATFORMS
93
+ ruby
94
+
95
+ DEPENDENCIES
96
+ fakefs (~> 0.4)
97
+ hoe (~> 3.0)
98
+ minitest (~> 3.0)
99
+ minitest-rails!
100
+ rails (~> 3.2.6)
101
+ rdoc (~> 3.10)
@@ -0,0 +1,4 @@
1
+ if RUBY_VERSION < "1.9"
2
+ `gem install minitest_tu_shim`
3
+ `use_minitest yes`
4
+ end
@@ -0,0 +1,5 @@
1
+ Autotest.add_discovery do
2
+ style = []
3
+ style = ["minitest", "rails"] if File.exist? 'config/application.rb'
4
+ style
5
+ end
@@ -0,0 +1,7 @@
1
+ module Autotest::Fixtures
2
+ Autotest.add_hook :initialize do |at|
3
+ at.test_mappings['^test/fixtures/(.*)s.yml'] = proc { |filename, matches|
4
+ at.files_matching(/test\/\w+\/#{matches[1]}(_\w+)?.*_test.rb$/)
5
+ }
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Autotest::Migrate
2
+ Autotest.add_hook(:run) do |autotest|
3
+ system "rake db:migrate" if autotest.class.to_s == "MinitestRails"
4
+ end
5
+ end
@@ -0,0 +1,62 @@
1
+ require 'autotest'
2
+
3
+ class Autotest::MinitestRails < Autotest
4
+ VERSION = "0.2"
5
+
6
+ def initialize # :nodoc:
7
+ super
8
+
9
+ add_exception %r%^\./(?:db|doc|log|public|script|tmp|vendor)%
10
+
11
+ clear_mappings
12
+
13
+ add_mapping %r%^app/models/(.*)\.rb$% do |_, m|
14
+ files_matching %r%^test/models/#{m[1]}.*_test.rb$%
15
+ end
16
+
17
+ add_mapping %r%^app/controllers/(.*)_controller\.rb$% do |_, m|
18
+ if m[1] == "application" then
19
+ files_matching %r%^test/(controllers|views)/.*_test\.rb$%
20
+ else
21
+ files_matching %r%^test/(controllers|views)/#{m[1]}.*_test.rb$%
22
+ end
23
+ end
24
+
25
+ add_mapping %r%^app/helpers/(.*)_helper.rb% do |_, m|
26
+ if m[1] == "application" then
27
+ files_matching %r%^test/(helpers|views|controllers)/.*_test\.rb$%
28
+ else
29
+ files_matching %r%^test/(helpers|views|controllers)/#{m[1]}.*_test.rb$%
30
+ end
31
+ end
32
+
33
+ add_mapping %r%^app/views/(.*)/% do |_, m|
34
+ files_matching %r%^test/(controllers|views)/#{m[1]}.*_test.rb$%
35
+ end
36
+
37
+ add_mapping %r%^app/mailers/(.*)\.rb$% do |_, m|
38
+ files_matching %r%^test/mailers/#{m[1]}.*_test.rb$%
39
+ end
40
+
41
+
42
+ add_mapping %r%^app/lib/(.*)\.rb$% do |_, m|
43
+ files_matching %r%^test/lib/#{m[1]}.*_test.rb$%
44
+ end
45
+
46
+ add_mapping %r%^test/.*_test\.rb$% do |filename, _|
47
+ filename
48
+ end
49
+
50
+ add_mapping %r%^test/fixtures/(.*)s.yml% do |_, m|
51
+ files_matching %r%^test/(models|controllers|views)/#{m[1]}.*_test.rb$%
52
+ end
53
+
54
+ add_mapping %r%^config/routes.rb$% do # FIX:
55
+ files_matching %r%^test/(controllers|views|acceptance)/.*_test\.rb$%
56
+ end
57
+
58
+ add_mapping %r%^test/*_helper.rb|config/((boot|environment(s/test)?).rb|database.yml)% do
59
+ files_matching %r%^test/(models|controllers|views|lib|acceptance)/.*_test\.rb$%
60
+ end
61
+ end
62
+ end
@@ -7,12 +7,20 @@ module MiniTest
7
7
  @_minitest_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'mini_test', generator_name, 'templates'))
8
8
  end
9
9
 
10
- begin
11
- # This method doesn't exist in Rails 3.0
10
+ if ::Rails.version.to_f < 3.1
11
+ protected
12
+ # These methods don't exist in Rails 3.0
12
13
  def module_namespacing(&block)
13
14
  yield if block_given?
14
15
  end
15
- end unless respond_to?(:module_namespacing)
16
+ def key_value(key, value)
17
+ if options[:old_style_hash] || RUBY_VERSION < '1.9'
18
+ ":#{key} => #{value}"
19
+ else
20
+ "#{key}: #{value}"
21
+ end
22
+ end
23
+ end
16
24
  end
17
25
  end
18
26
  end
@@ -9,10 +9,52 @@ module MiniTest
9
9
 
10
10
  # Use AC::TestCase for the base class when describing a controller
11
11
  register_spec_type(self) do |desc|
12
- desc < ::ActionController::Base
12
+ desc < ::ActionController::Base if desc.is_a?(Class)
13
13
  end
14
+ register_spec_type(/Controller( ?Test)?\z/i, self)
14
15
 
15
16
  include ::ActionController::TestCase::Behavior
17
+
18
+ def self.determine_default_controller_class(name)
19
+ # Override this method to support nested describes
20
+ #
21
+ # describe WidgetsController do
22
+ # describe "index" do
23
+ # it "is successful" do
24
+ # assert_response :success
25
+ # end
26
+ # end
27
+ # end
28
+ #
29
+ # Original implementation:
30
+ # name.sub(/Test$/, '').safe_constantize
31
+ # safe_constantize is not supported in Rails 3.0...
32
+ ControllerLookup.find name
33
+ end
34
+ end
35
+
36
+ module ControllerLookup
37
+ def self.find controller
38
+ # HACK: I don't love this implementation
39
+ # Please suggest a better one!
40
+ names = controller.split "::"
41
+ controller = while names.size > 0 do
42
+ # Remove "Test" if present
43
+ names.last.sub! /Test$/, ''
44
+ begin
45
+ constant = names.join("::").constantize
46
+ break(constant) if constant
47
+ rescue NameError
48
+ # do nothing
49
+ ensure
50
+ names.pop
51
+ end
52
+ end
53
+ if controller.nil?
54
+ raise ::NameError.new("Unable to resolve controller for #{name}")
55
+ end
56
+ controller
57
+ end
16
58
  end
17
59
  end
18
60
  end
@@ -1,5 +1,7 @@
1
1
  require 'minitest/rails/active_support'
2
2
  require 'action_dispatch/testing/integration'
3
+ require 'action_controller/test_case'
4
+ require 'action_dispatch/routing/url_for'
3
5
 
4
6
  module MiniTest
5
7
  module Rails
@@ -24,13 +26,11 @@ module MiniTest
24
26
  def app
25
27
  super || ::ActionDispatch::IntegrationTest.app
26
28
  end
29
+
30
+ # Register by name
31
+ register_spec_type(/Acceptance ?Test\z/i, self)
32
+ register_spec_type(/Integration ?Test\z/i, self)
27
33
  end
28
34
  end
29
35
  end
30
36
  end
31
-
32
- # Register by name
33
- MiniTest::Spec.register_spec_type(/AcceptanceTest$/, MiniTest::Rails::ActionDispatch::IntegrationTest)
34
- MiniTest::Spec.register_spec_type(/Acceptance Test$/, MiniTest::Rails::ActionDispatch::IntegrationTest)
35
- MiniTest::Spec.register_spec_type(/IntegrationTest$/, MiniTest::Rails::ActionDispatch::IntegrationTest)
36
- MiniTest::Spec.register_spec_type(/Integration Test$/, MiniTest::Rails::ActionDispatch::IntegrationTest)