minitest-rails 0.3 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/.travis.yml +4 -2
  2. data/LICENSE +1 -1
  3. data/Manifest.txt +5 -8
  4. data/README.rdoc +11 -29
  5. data/Rakefile +3 -3
  6. data/gemfiles/3.0.gemfile +1 -1
  7. data/gemfiles/3.0.gemfile.lock +35 -35
  8. data/gemfiles/3.1.gemfile +1 -1
  9. data/gemfiles/3.1.gemfile.lock +35 -35
  10. data/gemfiles/3.2.gemfile +1 -1
  11. data/gemfiles/3.2.gemfile.lock +39 -38
  12. data/gemfiles/4.0.gemfile +8 -0
  13. data/gemfiles/4.0.gemfile.lock +104 -0
  14. data/lib/generators/mini_test.rb +25 -12
  15. data/lib/generators/mini_test/controller/templates/controller_test.rb +1 -1
  16. data/lib/generators/mini_test/helper/templates/helper_test.rb +2 -2
  17. data/lib/generators/mini_test/install/install_generator.rb +1 -1
  18. data/lib/generators/mini_test/install/templates/test/minitest_helper.rb +3 -9
  19. data/lib/generators/mini_test/integration/integration_generator.rb +2 -2
  20. data/lib/generators/mini_test/integration/templates/integration_spec.rb +2 -2
  21. data/lib/generators/mini_test/integration/templates/integration_test.rb +1 -1
  22. data/lib/generators/mini_test/mailer/templates/mailer_test.rb +1 -1
  23. data/lib/generators/mini_test/model/templates/model_test.rb +1 -1
  24. data/lib/generators/mini_test/scaffold/templates/controller_test.rb +1 -1
  25. data/lib/minitest/rails.rb +109 -20
  26. data/lib/minitest/rails/constant_lookup.rb +41 -44
  27. data/lib/minitest/rails/tasks/minitest.rake +22 -51
  28. data/lib/minitest/rails/test_case.rb +93 -0
  29. data/lib/minitest/rails/testing.rb +39 -0
  30. data/lib/minitest/rails/version.rb +1 -1
  31. data/minitest-rails.gemspec +11 -11
  32. data/tasks/gemfiles.rake +2 -1
  33. data/tasks/test.rake +6 -0
  34. data/test/generators/test_controller_generator.rb +10 -39
  35. data/test/generators/test_helper_generator.rb +8 -35
  36. data/test/generators/test_install_generator.rb +4 -27
  37. data/test/generators/test_mailer_generator.rb +5 -29
  38. data/test/generators/test_model_generator.rb +7 -32
  39. data/test/generators/test_scaffold_generator.rb +5 -29
  40. data/test/helper.rb +35 -0
  41. data/test/rails/action_controller/test_controllers.rb +4 -14
  42. data/test/rails/action_controller/test_spec_type.rb +3 -7
  43. data/test/rails/action_dispatch/test_spec_type.rb +16 -11
  44. data/test/rails/action_mailer/test_mailers.rb +4 -8
  45. data/test/rails/action_mailer/test_spec_type.rb +3 -8
  46. data/test/rails/action_view/test_helpers.rb +4 -7
  47. data/test/rails/action_view/test_spec_type.rb +3 -10
  48. data/test/rails/active_support/test_spec_type.rb +2 -7
  49. data/test/rails/test_constant_lookup.rb +2 -5
  50. data/test/test_sanity.rb +1 -2
  51. metadata +33 -36
  52. data/gemfiles/minitest_tu_shim.rb +0 -4
  53. data/lib/minitest/rails/action_controller.rb +0 -28
  54. data/lib/minitest/rails/action_dispatch.rb +0 -41
  55. data/lib/minitest/rails/action_mailer.rb +0 -26
  56. data/lib/minitest/rails/action_view.rb +0 -23
  57. data/lib/minitest/rails/active_support.rb +0 -70
  58. data/lib/minitest/rails/declarative.rb +0 -27
  59. data/lib/minitest/rails/mochaing.rb +0 -11
@@ -1,13 +1,9 @@
1
- require "minitest/autorun"
2
- require "rails"
3
-
4
- require "action_mailer"
5
- require "minitest/rails/action_mailer"
1
+ require "helper"
6
2
 
7
3
  class TestTestMailer < ActionMailer::Base; end
8
4
 
9
5
  # From Rails...
10
- class CrazyNameMailerTest < MiniTest::Rails::ActionMailer::TestCase
6
+ class CrazyNameMailerTest < ActionMailer::TestCase
11
7
  tests TestTestMailer
12
8
 
13
9
  def test_set_mailer_class_manual
@@ -15,7 +11,7 @@ class CrazyNameMailerTest < MiniTest::Rails::ActionMailer::TestCase
15
11
  end
16
12
  end
17
13
 
18
- class CrazySymbolNameMailerTest < MiniTest::Rails::ActionMailer::TestCase
14
+ class CrazySymbolNameMailerTest < ActionMailer::TestCase
19
15
  tests :test_test_mailer
20
16
 
21
17
  def test_set_mailer_class_manual_using_symbol
@@ -23,7 +19,7 @@ class CrazySymbolNameMailerTest < MiniTest::Rails::ActionMailer::TestCase
23
19
  end
24
20
  end if Rails::VERSION::STRING >= "3.2"
25
21
 
26
- class CrazyStringNameMailerTest < MiniTest::Rails::ActionMailer::TestCase
22
+ class CrazyStringNameMailerTest < ActionMailer::TestCase
27
23
  tests 'test_test_mailer'
28
24
 
29
25
  def test_set_mailer_class_manual_using_string
@@ -1,20 +1,15 @@
1
- require "minitest/autorun"
2
- require "rails"
3
-
4
- require "action_mailer/test_helper"
5
- require "minitest/rails/action_mailer"
6
- require "action_mailer"
1
+ require "helper"
7
2
 
8
3
  class NotificationMailer < ActionMailer::Base; end
9
4
  class Notifications < ActionMailer::Base; end
10
5
 
11
6
  class TestActionMailerSpecType < MiniTest::Unit::TestCase
12
7
  def assert_mailer actual
13
- assert_equal MiniTest::Rails::ActionMailer::TestCase, actual
8
+ assert_equal ActionMailer::TestCase, actual
14
9
  end
15
10
 
16
11
  def refute_mailer actual
17
- refute_equal MiniTest::Rails::ActionMailer::TestCase, actual
12
+ refute_equal ActionMailer::TestCase, actual
18
13
  end
19
14
 
20
15
  def test_spec_type_resolves_for_class_constants
@@ -1,7 +1,4 @@
1
- require "minitest/autorun"
2
- require "rails"
3
-
4
- require "minitest/rails/action_view"
1
+ require "helper"
5
2
 
6
3
  module PeopleHelper
7
4
  def title(text)
@@ -22,7 +19,7 @@ module PeopleHelper
22
19
  end
23
20
 
24
21
  # From Rails...
25
- class CrazyHelperTest < MiniTest::Rails::ActionView::TestCase
22
+ class CrazyHelperTest < ActionView::TestCase
26
23
  tests PeopleHelper
27
24
 
28
25
  def test_helper_class_can_be_set_manually_not_just_inferred
@@ -30,7 +27,7 @@ class CrazyHelperTest < MiniTest::Rails::ActionView::TestCase
30
27
  end
31
28
  end
32
29
 
33
- class CrazySymbolHelperTest < MiniTest::Rails::ActionView::TestCase
30
+ class CrazySymbolHelperTest < ActionView::TestCase
34
31
  tests :people
35
32
 
36
33
  def test_set_helper_class_using_symbol
@@ -38,7 +35,7 @@ class CrazySymbolHelperTest < MiniTest::Rails::ActionView::TestCase
38
35
  end
39
36
  end if Rails::VERSION::STRING >= "3.2"
40
37
 
41
- class CrazyStringHelperTest < MiniTest::Rails::ActionView::TestCase
38
+ class CrazyStringHelperTest < ActionView::TestCase
42
39
  tests 'people'
43
40
 
44
41
  def test_set_helper_class_using_string
@@ -1,15 +1,12 @@
1
- require "minitest/autorun"
2
- require "rails"
3
-
4
- require "minitest/rails/action_view"
1
+ require "helper"
5
2
 
6
3
  class TestActionViewSpecType < MiniTest::Unit::TestCase
7
4
  def assert_view actual
8
- assert_equal MiniTest::Rails::ActionView::TestCase, actual
5
+ assert_equal ActionView::TestCase, actual
9
6
  end
10
7
 
11
8
  def refute_view actual
12
- refute_equal MiniTest::Rails::ActionView::TestCase, actual
9
+ refute_equal ActionView::TestCase, actual
13
10
  end
14
11
 
15
12
  def test_spec_type_resolves_for_matching_helper_strings
@@ -23,12 +20,8 @@ class TestActionViewSpecType < MiniTest::Unit::TestCase
23
20
  end
24
21
 
25
22
  def test_spec_type_resolves_for_matching_view_strings
26
- assert_view MiniTest::Spec.spec_type("WidgetView")
27
- assert_view MiniTest::Spec.spec_type("WidgetViewTest")
28
23
  assert_view MiniTest::Spec.spec_type("Widget View Test")
29
24
  # And is not case sensitive
30
- assert_view MiniTest::Spec.spec_type("widgetview")
31
- assert_view MiniTest::Spec.spec_type("widgetviewtest")
32
25
  assert_view MiniTest::Spec.spec_type("widget view test")
33
26
  end
34
27
 
@@ -1,16 +1,11 @@
1
- require "minitest/autorun"
2
- require "rails"
3
-
4
- require "active_record"
5
- load "minitest/rails/active_support.rb" # Force reload
6
- # Not sure why we need to reload, but we do...
1
+ require "helper"
7
2
 
8
3
  class SomeRandomModel < ActiveRecord::Base; end
9
4
 
10
5
  class TestActiveSupportSpecType < MiniTest::Unit::TestCase
11
6
 
12
7
  def assert_support actual
13
- assert_equal MiniTest::Rails::ActiveSupport::TestCase, actual
8
+ assert_equal ActiveSupport::TestCase, actual
14
9
  end
15
10
 
16
11
  def assert_spec actual
@@ -1,7 +1,4 @@
1
- require "minitest/autorun"
2
- require "rails"
3
-
4
- require "minitest/rails/active_support"
1
+ require "helper"
5
2
 
6
3
  class Foo; end
7
4
  class Bar < Foo;
@@ -11,7 +8,7 @@ end
11
8
  class Baz < Bar; end
12
9
  module FooBar; end
13
10
 
14
- class TestLookup < MiniTest::Rails::ActiveSupport::TestCase
11
+ class TestLookup < ActiveSupport::TestCase
15
12
 
16
13
  def find_foo(name)
17
14
  self.class.determine_constant_from_test_name(name) do |constant|
data/test/test_sanity.rb CHANGED
@@ -1,5 +1,4 @@
1
- require "minitest/autorun"
2
- require "minitest-rails"
1
+ require "helper"
3
2
 
4
3
  class TestMiniTest < MiniTest::Unit::TestCase
5
4
  def test_sanity
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
5
4
  prerelease:
5
+ version: '0.5'
6
6
  platform: ruby
7
7
  authors:
8
8
  - Mike Moore
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-02 00:00:00.000000000 Z
12
+ date: 2013-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
+ prerelease: false
16
+ type: :runtime
15
17
  name: minitest
16
- requirement: !ruby/object:Gem::Requirement
18
+ version_requirements: !ruby/object:Gem::Requirement
17
19
  none: false
18
20
  requirements:
19
21
  - - ~>
20
22
  - !ruby/object:Gem::Version
21
23
  version: '4.0'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
24
+ requirement: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: '4.0'
30
30
  - !ruby/object:Gem::Dependency
31
+ prerelease: false
32
+ type: :runtime
31
33
  name: rails
32
- requirement: !ruby/object:Gem::Requirement
34
+ version_requirements: !ruby/object:Gem::Requirement
33
35
  none: false
34
36
  requirements:
35
- - - ~>
37
+ - - ! '>='
36
38
  - !ruby/object:Gem::Version
37
39
  version: '3.0'
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
40
+ requirement: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ~>
43
+ - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '3.0'
46
46
  - !ruby/object:Gem::Dependency
47
+ prerelease: false
48
+ type: :development
47
49
  name: rdoc
48
- requirement: !ruby/object:Gem::Requirement
50
+ version_requirements: !ruby/object:Gem::Requirement
49
51
  none: false
50
52
  requirements:
51
53
  - - ~>
52
54
  - !ruby/object:Gem::Version
53
55
  version: '3.10'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
56
+ requirement: !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.10'
62
62
  - !ruby/object:Gem::Dependency
63
+ prerelease: false
64
+ type: :development
63
65
  name: fakefs
64
- requirement: !ruby/object:Gem::Requirement
66
+ version_requirements: !ruby/object:Gem::Requirement
65
67
  none: false
66
68
  requirements:
67
69
  - - ~>
68
70
  - !ruby/object:Gem::Version
69
71
  version: '0.4'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
72
+ requirement: !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0.4'
78
78
  - !ruby/object:Gem::Dependency
79
+ prerelease: false
80
+ type: :development
79
81
  name: hoe
80
- requirement: !ruby/object:Gem::Requirement
82
+ version_requirements: !ruby/object:Gem::Requirement
81
83
  none: false
82
84
  requirements:
83
85
  - - ~>
84
86
  - !ruby/object:Gem::Version
85
- version: '3.1'
86
- type: :development
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
87
+ version: '3.4'
88
+ requirement: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: '3.1'
94
- description: Adds MiniTest as the default testing library in Rails 3.x
93
+ version: '3.4'
94
+ description: Adds MiniTest as the default testing library in Rails 3 and 4
95
95
  email:
96
96
  - mike@blowmage.com
97
97
  executables: []
@@ -115,7 +115,8 @@ files:
115
115
  - gemfiles/3.1.gemfile.lock
116
116
  - gemfiles/3.2.gemfile
117
117
  - gemfiles/3.2.gemfile.lock
118
- - gemfiles/minitest_tu_shim.rb
118
+ - gemfiles/4.0.gemfile
119
+ - gemfiles/4.0.gemfile.lock
119
120
  - lib/autotest/discover.rb
120
121
  - lib/autotest/fixtures.rb
121
122
  - lib/autotest/migrate.rb
@@ -144,16 +145,11 @@ files:
144
145
  - lib/generators/mini_test/scaffold/templates/controller_test.rb
145
146
  - lib/minitest-rails.rb
146
147
  - lib/minitest/rails.rb
147
- - lib/minitest/rails/action_controller.rb
148
- - lib/minitest/rails/action_dispatch.rb
149
- - lib/minitest/rails/action_mailer.rb
150
- - lib/minitest/rails/action_view.rb
151
- - lib/minitest/rails/active_support.rb
152
148
  - lib/minitest/rails/constant_lookup.rb
153
- - lib/minitest/rails/declarative.rb
154
- - lib/minitest/rails/mochaing.rb
155
149
  - lib/minitest/rails/tasks/minitest.rake
156
150
  - lib/minitest/rails/tasks/sub_test_task.rb
151
+ - lib/minitest/rails/test_case.rb
152
+ - lib/minitest/rails/testing.rb
157
153
  - lib/minitest/rails/version.rb
158
154
  - minitest-rails.gemspec
159
155
  - tasks/gemfiles.rake
@@ -164,6 +160,7 @@ files:
164
160
  - test/generators/test_mailer_generator.rb
165
161
  - test/generators/test_model_generator.rb
166
162
  - test/generators/test_scaffold_generator.rb
163
+ - test/helper.rb
167
164
  - test/rails/action_controller/test_controllers.rb
168
165
  - test/rails/action_controller/test_spec_type.rb
169
166
  - test/rails/action_dispatch/test_spec_type.rb
@@ -199,7 +196,7 @@ rubyforge_project: minitest-rails
199
196
  rubygems_version: 1.8.23
200
197
  signing_key:
201
198
  specification_version: 3
202
- summary: MiniTest integration for Rails 3.x
199
+ summary: MiniTest integration for Rails 3 and 4
203
200
  test_files:
204
201
  - test/generators/test_controller_generator.rb
205
202
  - test/generators/test_helper_generator.rb
@@ -1,4 +0,0 @@
1
- if RUBY_VERSION < "1.9"
2
- `gem install minitest_tu_shim`
3
- `use_minitest yes`
4
- end
@@ -1,28 +0,0 @@
1
- require "minitest/rails/active_support"
2
- require "action_controller/test_case"
3
-
4
- module MiniTest
5
- module Rails
6
- module ActionController
7
- class TestCase < MiniTest::Rails::ActiveSupport::TestCase
8
- RaiseActionExceptions = ::ActionController::TestCase::RaiseActionExceptions
9
-
10
- # Use AC::TestCase for the base class when describing a controller
11
- register_spec_type(self) do |desc|
12
- desc < ::ActionController::Base if desc.is_a?(Class)
13
- end
14
- register_spec_type(/Controller( ?Test)?\z/i, self)
15
-
16
- include ::ActionController::TestCase::Behavior
17
-
18
- def self.determine_default_controller_class(name)
19
- controller = determine_constant_from_test_name(name) do |constant|
20
- Class === constant && constant < ::ActionController::Metal
21
- end
22
- raise ::NameError.new("Unable to resolve controller for #{name}") if controller.nil?
23
- controller
24
- end
25
- end
26
- end
27
- end
28
- end
@@ -1,41 +0,0 @@
1
- require 'minitest/rails/active_support'
2
- require 'action_dispatch/testing/integration'
3
- require 'action_controller/test_case'
4
- require 'action_dispatch/routing/url_for'
5
-
6
- module MiniTest
7
- module Rails
8
- module ActionDispatch
9
- class IntegrationTest < MiniTest::Rails::ActiveSupport::TestCase
10
- include ::ActionDispatch::Integration::Runner
11
- include ::ActionController::TemplateAssertions
12
- include ::ActionDispatch::Routing::UrlFor
13
-
14
- @@app = nil
15
-
16
- def self.app
17
- # DEPRECATE Rails application fallback
18
- # This should be set by the initializer
19
- @@app || (defined?(::Rails.application) && ::Rails.application) || nil
20
- end
21
-
22
- def self.app=(app)
23
- @@app = app
24
- end
25
-
26
- def app
27
- super || ::ActionDispatch::IntegrationTest.app
28
- end
29
-
30
- def url_options
31
- reset! unless integration_session
32
- integration_session.url_options
33
- end
34
-
35
- # Register by name
36
- register_spec_type(/Acceptance ?Test\z/i, self)
37
- register_spec_type(/Integration ?Test\z/i, self)
38
- end
39
- end
40
- end
41
- end
@@ -1,26 +0,0 @@
1
- require "minitest/rails/active_support"
2
- require "action_mailer/test_case"
3
-
4
- module MiniTest
5
- module Rails
6
- module ActionMailer
7
- class TestCase < MiniTest::Rails::ActiveSupport::TestCase
8
- # Use AM::TestCase for the base class when describing a mailer
9
- register_spec_type(self) do |desc|
10
- desc < ::ActionMailer::Base if desc.is_a?(Class)
11
- end
12
- register_spec_type(/Mailer( ?Test)?\z/i, self)
13
-
14
- include ::ActionMailer::TestCase::Behavior
15
-
16
- def self.determine_default_mailer(name)
17
- mailer = determine_constant_from_test_name(name) do |constant|
18
- Class === constant && constant < ::ActionMailer::Base
19
- end
20
- raise ::ActionMailer::NonInferrableMailerError.new(name) if mailer.nil?
21
- mailer
22
- end
23
- end
24
- end
25
- end
26
- end