minitest-spec-rails 4.3.1 → 4.3.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.
- data/CHANGELOG.md +5 -0
- data/gemfiles/rails30.gemfile.lock +1 -1
- data/gemfiles/rails31.gemfile.lock +1 -1
- data/gemfiles/rails32.gemfile.lock +1 -1
- data/gemfiles/rails40.gemfile.lock +1 -1
- data/lib/minitest-spec-rails/init/action_controller.rb +18 -12
- data/lib/minitest-spec-rails/init/action_dispatch.rb +16 -0
- data/lib/minitest-spec-rails/init/action_mailer.rb +20 -6
- data/lib/minitest-spec-rails/init/action_view.rb +31 -16
- data/lib/minitest-spec-rails/railtie.rb +11 -3
- data/lib/minitest-spec-rails/version.rb +1 -1
- data/lib/test/unit/testcase.rb +27 -1
- data/test/dummy_tests/application_controller_test.rb +35 -0
- data/test/dummy_tests/user_mailer_test.rb +35 -0
- data/test/dummy_tests/users_helper_test.rb +35 -0
- metadata +4 -3
data/CHANGELOG.md
CHANGED
@@ -1,18 +1,24 @@
|
|
1
|
-
|
1
|
+
module MiniTestSpecRails
|
2
|
+
module Init
|
3
|
+
module ActionControllerBehavior
|
2
4
|
|
3
|
-
|
4
|
-
Class === desc && desc < ActionController::Metal
|
5
|
-
end
|
6
|
-
|
7
|
-
register_spec_type(/Controller( ?Test)?\z/i, self)
|
8
|
-
|
9
|
-
before { self.class.controller_class }
|
5
|
+
extend ActiveSupport::Concern
|
10
6
|
|
11
|
-
|
7
|
+
included do
|
8
|
+
register_spec_type(self) { |desc| Class === desc && desc < ActionController::Metal }
|
9
|
+
register_spec_type(/Controller( ?Test)?\z/i, self)
|
10
|
+
register_spec_type(self) { |desc| Class === desc && desc < self }
|
11
|
+
end
|
12
12
|
|
13
|
-
|
14
|
-
ActionDispatch::IntegrationTest.instance_eval do
|
13
|
+
private
|
15
14
|
|
16
|
-
|
15
|
+
def setup_controller_request_and_response
|
16
|
+
describing_class.tests described_class
|
17
|
+
super
|
18
|
+
end
|
17
19
|
|
20
|
+
end
|
21
|
+
end
|
18
22
|
end
|
23
|
+
|
24
|
+
ActionController::TestCase.send :include, MiniTestSpecRails::Init::ActionControllerBehavior
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module MiniTestSpecRails
|
2
|
+
module Init
|
3
|
+
module ActionDispatchBehavior
|
4
|
+
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
register_spec_type(/(Acceptance|Integration) ?Test\z/i, self)
|
9
|
+
register_spec_type(self) { |desc| Class === desc && desc < self }
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
ActionDispatch::IntegrationTest.send :include, MiniTestSpecRails::Init::ActionDispatchBehavior
|
@@ -1,11 +1,25 @@
|
|
1
|
-
|
1
|
+
module MiniTestSpecRails
|
2
|
+
module Init
|
3
|
+
module ActionMailerBehavior
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
register_spec_type(self) { |desc| Class === desc && desc < ActionMailer::Base }
|
9
|
+
register_spec_type(/Mailer( ?Test)?\z/i, self)
|
10
|
+
register_spec_type(self) { |desc| Class === desc && desc < self }
|
11
|
+
before { setup_minitest_spec_rails_mailer_class }
|
12
|
+
end
|
6
13
|
|
7
|
-
|
14
|
+
private
|
8
15
|
|
9
|
-
|
16
|
+
def setup_minitest_spec_rails_mailer_class
|
17
|
+
describing_class.tests described_class
|
18
|
+
end
|
10
19
|
|
20
|
+
end
|
21
|
+
end
|
11
22
|
end
|
23
|
+
|
24
|
+
ActionMailer::TestCase.send :include, MiniTestSpecRails::Init::ActionMailerBehavior
|
25
|
+
|
@@ -1,21 +1,36 @@
|
|
1
|
-
|
1
|
+
module MiniTestSpecRails
|
2
|
+
module Init
|
3
|
+
module ActionViewBehavior
|
2
4
|
|
3
|
-
|
5
|
+
extend ActiveSupport::Concern
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
current_helper_class
|
14
|
-
else
|
15
|
-
self.helper_class = determine_default_helper_class(name)
|
16
|
-
end
|
17
|
-
end
|
7
|
+
included do
|
8
|
+
class_attribute :_helper_class
|
9
|
+
register_spec_type(/(Helper|View)( ?Test)?\z/i, self)
|
10
|
+
register_spec_type(self) { |desc| Class === desc && desc < self }
|
11
|
+
before { setup_minitest_spec_rails_helper_class }
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
18
15
|
|
19
|
-
|
16
|
+
def helper_class=(new_class)
|
17
|
+
self._helper_class = new_class
|
18
|
+
end
|
19
|
+
|
20
|
+
def helper_class
|
21
|
+
if current_helper_class = self._helper_class
|
22
|
+
current_helper_class
|
23
|
+
else
|
24
|
+
self.helper_class = determine_default_helper_class(name)
|
25
|
+
end
|
26
|
+
end
|
20
27
|
|
28
|
+
def setup_minitest_spec_rails_helper_class
|
29
|
+
self.class.helper_class = described_class
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
21
34
|
end
|
35
|
+
|
36
|
+
ActionView::TestCase.send :include, MiniTestSpecRails::Init::ActionViewBehavior
|
@@ -4,9 +4,17 @@ module MiniTestSpecRails
|
|
4
4
|
config.minitest_spec_rails = ActiveSupport::OrderedOptions.new
|
5
5
|
|
6
6
|
config.before_initialize do |app|
|
7
|
-
ActiveSupport.on_load(:action_view)
|
8
|
-
|
9
|
-
|
7
|
+
ActiveSupport.on_load(:action_view) do
|
8
|
+
require 'minitest-spec-rails/init/action_view'
|
9
|
+
end
|
10
|
+
ActiveSupport.on_load(:action_controller) do
|
11
|
+
require 'minitest-spec-rails/init/action_controller'
|
12
|
+
require 'action_dispatch/testing/integration' # For Rails 3.0 loading.
|
13
|
+
require 'minitest-spec-rails/init/action_dispatch'
|
14
|
+
end
|
15
|
+
ActiveSupport.on_load(:action_mailer) do
|
16
|
+
require 'minitest-spec-rails/init/action_mailer'
|
17
|
+
end
|
10
18
|
end
|
11
19
|
|
12
20
|
initializer 'minitest-spec-rails.after.load_active_support', :after => :load_active_support, :group => :all do |app|
|
data/lib/test/unit/testcase.rb
CHANGED
@@ -8,8 +8,12 @@ module Test
|
|
8
8
|
remove_const(:TestCase) if defined?(self::TestCase)
|
9
9
|
class TestCase < ::MiniTest::Spec
|
10
10
|
|
11
|
+
# Let Others Know
|
12
|
+
|
11
13
|
MINITEST_SPEC_RAILS = true
|
12
14
|
|
15
|
+
# Test::Unit Compatability
|
16
|
+
|
13
17
|
def mu_pp(obj)
|
14
18
|
obj.pretty_inspect.chomp
|
15
19
|
end
|
@@ -22,10 +26,32 @@ module Test
|
|
22
26
|
template &&= template.chomp
|
23
27
|
template.gsub(/\G((?:[^\\]|\\.)*?)(\\)?\?/) { $1 + ($2 ? "?" : mu_pp(arguments.shift)) }
|
24
28
|
end
|
29
|
+
|
30
|
+
# MiniTestSpecRails Additions
|
31
|
+
|
32
|
+
def self.describing_class
|
33
|
+
ancestors.detect { |a| Class === a && a.superclass == spec_type(self) }
|
34
|
+
end
|
35
|
+
|
36
|
+
def describing_class
|
37
|
+
self.class.describing_class
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.described_class
|
41
|
+
begin
|
42
|
+
describing_class.name.gsub(/Test$/, '').constantize
|
43
|
+
rescue NameError
|
44
|
+
nil
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def described_class
|
49
|
+
self.class.described_class
|
50
|
+
end
|
25
51
|
|
26
52
|
end
|
27
53
|
|
28
54
|
end
|
29
55
|
end
|
30
56
|
|
31
|
-
silence_warnings { MiniTest::Unit::TestCase =
|
57
|
+
silence_warnings { MiniTest::Unit::TestCase = Test::Unit::TestCase }
|
@@ -46,8 +46,43 @@ end
|
|
46
46
|
|
47
47
|
class ApplicationControllerTest < ActionController::TestCase
|
48
48
|
include ApplicationControllerTests
|
49
|
+
it 'reflects' do
|
50
|
+
self.class.spec_type(self.class).must_equal ActionController::TestCase
|
51
|
+
describing_class.must_equal ApplicationControllerTest
|
52
|
+
described_class.must_equal ApplicationController
|
53
|
+
end
|
54
|
+
describe 'level 1' do
|
55
|
+
it 'reflects' do
|
56
|
+
self.class.spec_type(self.class).must_equal ActionController::TestCase
|
57
|
+
describing_class.must_equal ApplicationControllerTest
|
58
|
+
described_class.must_equal ApplicationController
|
59
|
+
end
|
60
|
+
describe 'level 2' do
|
61
|
+
it 'reflects' do
|
62
|
+
self.class.spec_type(self.class).must_equal ActionController::TestCase
|
63
|
+
describing_class.must_equal ApplicationControllerTest
|
64
|
+
described_class.must_equal ApplicationController
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
49
68
|
end
|
50
69
|
|
51
70
|
describe ApplicationController do
|
52
71
|
include ApplicationControllerTests
|
72
|
+
it 'reflects' do
|
73
|
+
self.class.spec_type(self.class).must_equal ActionController::TestCase
|
74
|
+
described_class.must_equal ApplicationController
|
75
|
+
end
|
76
|
+
describe 'level 1' do
|
77
|
+
it 'reflects' do
|
78
|
+
self.class.spec_type(self.class).must_equal ActionController::TestCase
|
79
|
+
described_class.must_equal ApplicationController
|
80
|
+
end
|
81
|
+
describe 'level 2' do
|
82
|
+
it 'reflects' do
|
83
|
+
self.class.spec_type(self.class).must_equal ActionController::TestCase
|
84
|
+
described_class.must_equal ApplicationController
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
53
88
|
end
|
@@ -48,8 +48,43 @@ end
|
|
48
48
|
|
49
49
|
class UserMailerTest < ActionMailer::TestCase
|
50
50
|
include UserMailerTests
|
51
|
+
it 'reflects' do
|
52
|
+
self.class.spec_type(self.class).must_equal ActionMailer::TestCase
|
53
|
+
describing_class.must_equal UserMailerTest
|
54
|
+
described_class.must_equal UserMailer
|
55
|
+
end
|
56
|
+
describe 'level 1' do
|
57
|
+
it 'reflects' do
|
58
|
+
self.class.spec_type(self.class).must_equal ActionMailer::TestCase
|
59
|
+
describing_class.must_equal UserMailerTest
|
60
|
+
described_class.must_equal UserMailer
|
61
|
+
end
|
62
|
+
describe 'level 2' do
|
63
|
+
it 'reflects' do
|
64
|
+
self.class.spec_type(self.class).must_equal ActionMailer::TestCase
|
65
|
+
describing_class.must_equal UserMailerTest
|
66
|
+
described_class.must_equal UserMailer
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
51
70
|
end
|
52
71
|
|
53
72
|
describe UserMailer do
|
54
73
|
include UserMailerTests
|
74
|
+
it 'reflects' do
|
75
|
+
self.class.spec_type(self.class).must_equal ActionMailer::TestCase
|
76
|
+
described_class.must_equal UserMailer
|
77
|
+
end
|
78
|
+
describe 'level 1' do
|
79
|
+
it 'reflects' do
|
80
|
+
self.class.spec_type(self.class).must_equal ActionMailer::TestCase
|
81
|
+
described_class.must_equal UserMailer
|
82
|
+
end
|
83
|
+
describe 'level 2' do
|
84
|
+
it 'reflects' do
|
85
|
+
self.class.spec_type(self.class).must_equal ActionMailer::TestCase
|
86
|
+
described_class.must_equal UserMailer
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
55
90
|
end
|
@@ -38,8 +38,43 @@ end
|
|
38
38
|
|
39
39
|
class UsersHelperTest < ActionView::TestCase
|
40
40
|
include UsersHelperTests
|
41
|
+
it 'reflects' do
|
42
|
+
self.class.spec_type(self.class).must_equal ActionView::TestCase
|
43
|
+
describing_class.must_equal UsersHelperTest
|
44
|
+
described_class.must_equal UsersHelper
|
45
|
+
end
|
46
|
+
describe 'level 1' do
|
47
|
+
it 'reflects' do
|
48
|
+
self.class.spec_type(self.class).must_equal ActionView::TestCase
|
49
|
+
describing_class.must_equal UsersHelperTest
|
50
|
+
described_class.must_equal UsersHelper
|
51
|
+
end
|
52
|
+
describe 'level 2' do
|
53
|
+
it 'reflects' do
|
54
|
+
self.class.spec_type(self.class).must_equal ActionView::TestCase
|
55
|
+
describing_class.must_equal UsersHelperTest
|
56
|
+
described_class.must_equal UsersHelper
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
41
60
|
end
|
42
61
|
|
43
62
|
describe UsersHelper do
|
44
63
|
include UsersHelperTests
|
64
|
+
it 'reflects' do
|
65
|
+
self.class.spec_type(self.class).must_equal ActionView::TestCase
|
66
|
+
described_class.must_equal UsersHelper
|
67
|
+
end
|
68
|
+
describe 'level 1' do
|
69
|
+
it 'reflects' do
|
70
|
+
self.class.spec_type(self.class).must_equal ActionView::TestCase
|
71
|
+
described_class.must_equal UsersHelper
|
72
|
+
end
|
73
|
+
describe 'level 2' do
|
74
|
+
it 'reflects' do
|
75
|
+
self.class.spec_type(self.class).must_equal ActionView::TestCase
|
76
|
+
described_class.must_equal UsersHelper
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
45
80
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-spec-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- gemfiles/rails40.gemfile.lock
|
134
134
|
- lib/minitest-spec-rails.rb
|
135
135
|
- lib/minitest-spec-rails/init/action_controller.rb
|
136
|
+
- lib/minitest-spec-rails/init/action_dispatch.rb
|
136
137
|
- lib/minitest-spec-rails/init/action_mailer.rb
|
137
138
|
- lib/minitest-spec-rails/init/action_view.rb
|
138
139
|
- lib/minitest-spec-rails/init/active_support.rb
|
@@ -184,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
185
|
version: '0'
|
185
186
|
segments:
|
186
187
|
- 0
|
187
|
-
hash:
|
188
|
+
hash: 1476361485121424446
|
188
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
190
|
none: false
|
190
191
|
requirements:
|
@@ -193,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
194
|
version: '0'
|
194
195
|
segments:
|
195
196
|
- 0
|
196
|
-
hash:
|
197
|
+
hash: 1476361485121424446
|
197
198
|
requirements: []
|
198
199
|
rubyforge_project:
|
199
200
|
rubygems_version: 1.8.24
|