minitest-spec-rails 6.2.0 → 7.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +8 -7
- data/Appraisals +5 -12
- data/CHANGELOG.md +13 -0
- data/README.md +24 -24
- data/gemfiles/rails_v6.0.x.gemfile.lock +107 -87
- data/gemfiles/{rails_v5.2.x.gemfile → rails_v6.1.x.gemfile} +1 -1
- data/gemfiles/rails_v6.1.x.gemfile.lock +175 -0
- data/gemfiles/rails_v7.0.x.gemfile +1 -2
- data/gemfiles/rails_v7.0.x.gemfile.lock +174 -0
- data/gemfiles/rails_v7.1.x.gemfile +9 -0
- data/lib/minitest-spec-rails/init/action_cable.rb +28 -0
- data/lib/minitest-spec-rails/init/action_view.rb +1 -3
- data/lib/minitest-spec-rails/init/active_support.rb +1 -1
- data/lib/minitest-spec-rails/railtie.rb +3 -0
- data/lib/minitest-spec-rails/version.rb +1 -1
- data/minitest-spec-rails.gemspec +4 -2
- data/test/cases/action_cable_test.rb +38 -0
- data/test/cases/action_controller_test.rb +13 -13
- data/test/cases/action_dispatch_test.rb +18 -18
- data/test/cases/action_mailer_test.rb +13 -13
- data/test/cases/action_view_test.rb +17 -17
- data/test/cases/active_job_test.rb +13 -13
- data/test/cases/active_support_test.rb +7 -7
- data/test/cases/mini_shoulda_test.rb +3 -3
- data/test/dummy_app/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy_app/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy_app/app/controllers/application_controller.rb +1 -1
- data/test/dummy_app/app/mailers/user_mailer.rb +1 -1
- data/test/dummy_app/init.rb +5 -12
- data/test/dummy_app/tmp/development_secret.txt +1 -0
- data/test/dummy_tests/application_controller_test.rb +19 -19
- data/test/dummy_tests/foos_helper_test.rb +2 -2
- data/test/dummy_tests/integration_test.rb +3 -3
- data/test/dummy_tests/library_test.rb +3 -3
- data/test/dummy_tests/user_mailer_test.rb +20 -21
- data/test/dummy_tests/user_test.rb +15 -15
- data/test/dummy_tests/users_controller_test.rb +1 -1
- data/test/dummy_tests/users_helper_test.rb +15 -15
- data/test/support/shared_test_case_behavior.rb +0 -4
- data/test/test_helper.rb +1 -1
- metadata +49 -12
- data/gemfiles/rails_v5.1.x.gemfile +0 -8
- data/gemfiles/rails_v5.1.x.gemfile.lock +0 -130
- data/gemfiles/rails_v5.2.x.gemfile.lock +0 -136
@@ -0,0 +1,174 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
minitest-spec-rails (7.1.0)
|
5
|
+
minitest (>= 5.0)
|
6
|
+
railties (>= 4.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (7.0.4.3)
|
12
|
+
actionpack (= 7.0.4.3)
|
13
|
+
activesupport (= 7.0.4.3)
|
14
|
+
nio4r (~> 2.0)
|
15
|
+
websocket-driver (>= 0.6.1)
|
16
|
+
actionmailbox (7.0.4.3)
|
17
|
+
actionpack (= 7.0.4.3)
|
18
|
+
activejob (= 7.0.4.3)
|
19
|
+
activerecord (= 7.0.4.3)
|
20
|
+
activestorage (= 7.0.4.3)
|
21
|
+
activesupport (= 7.0.4.3)
|
22
|
+
mail (>= 2.7.1)
|
23
|
+
net-imap
|
24
|
+
net-pop
|
25
|
+
net-smtp
|
26
|
+
actionmailer (7.0.4.3)
|
27
|
+
actionpack (= 7.0.4.3)
|
28
|
+
actionview (= 7.0.4.3)
|
29
|
+
activejob (= 7.0.4.3)
|
30
|
+
activesupport (= 7.0.4.3)
|
31
|
+
mail (~> 2.5, >= 2.5.4)
|
32
|
+
net-imap
|
33
|
+
net-pop
|
34
|
+
net-smtp
|
35
|
+
rails-dom-testing (~> 2.0)
|
36
|
+
actionpack (7.0.4.3)
|
37
|
+
actionview (= 7.0.4.3)
|
38
|
+
activesupport (= 7.0.4.3)
|
39
|
+
rack (~> 2.0, >= 2.2.0)
|
40
|
+
rack-test (>= 0.6.3)
|
41
|
+
rails-dom-testing (~> 2.0)
|
42
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
43
|
+
actiontext (7.0.4.3)
|
44
|
+
actionpack (= 7.0.4.3)
|
45
|
+
activerecord (= 7.0.4.3)
|
46
|
+
activestorage (= 7.0.4.3)
|
47
|
+
activesupport (= 7.0.4.3)
|
48
|
+
globalid (>= 0.6.0)
|
49
|
+
nokogiri (>= 1.8.5)
|
50
|
+
actionview (7.0.4.3)
|
51
|
+
activesupport (= 7.0.4.3)
|
52
|
+
builder (~> 3.1)
|
53
|
+
erubi (~> 1.4)
|
54
|
+
rails-dom-testing (~> 2.0)
|
55
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
56
|
+
activejob (7.0.4.3)
|
57
|
+
activesupport (= 7.0.4.3)
|
58
|
+
globalid (>= 0.3.6)
|
59
|
+
activemodel (7.0.4.3)
|
60
|
+
activesupport (= 7.0.4.3)
|
61
|
+
activerecord (7.0.4.3)
|
62
|
+
activemodel (= 7.0.4.3)
|
63
|
+
activesupport (= 7.0.4.3)
|
64
|
+
activestorage (7.0.4.3)
|
65
|
+
actionpack (= 7.0.4.3)
|
66
|
+
activejob (= 7.0.4.3)
|
67
|
+
activerecord (= 7.0.4.3)
|
68
|
+
activesupport (= 7.0.4.3)
|
69
|
+
marcel (~> 1.0)
|
70
|
+
mini_mime (>= 1.1.0)
|
71
|
+
activesupport (7.0.4.3)
|
72
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
73
|
+
i18n (>= 1.6, < 2)
|
74
|
+
minitest (>= 5.1)
|
75
|
+
tzinfo (~> 2.0)
|
76
|
+
appraisal (2.4.1)
|
77
|
+
bundler
|
78
|
+
rake
|
79
|
+
thor (>= 0.14.0)
|
80
|
+
builder (3.2.4)
|
81
|
+
coderay (1.1.3)
|
82
|
+
concurrent-ruby (1.2.2)
|
83
|
+
crass (1.0.6)
|
84
|
+
date (3.3.3)
|
85
|
+
erubi (1.12.0)
|
86
|
+
globalid (1.1.0)
|
87
|
+
activesupport (>= 5.0)
|
88
|
+
i18n (1.13.0)
|
89
|
+
concurrent-ruby (~> 1.0)
|
90
|
+
loofah (2.21.3)
|
91
|
+
crass (~> 1.0.2)
|
92
|
+
nokogiri (>= 1.12.0)
|
93
|
+
mail (2.8.1)
|
94
|
+
mini_mime (>= 0.1.1)
|
95
|
+
net-imap
|
96
|
+
net-pop
|
97
|
+
net-smtp
|
98
|
+
marcel (1.0.2)
|
99
|
+
method_source (1.0.0)
|
100
|
+
mini_mime (1.1.2)
|
101
|
+
minitest (5.18.0)
|
102
|
+
minitest-focus (1.3.1)
|
103
|
+
minitest (>= 4, < 6)
|
104
|
+
net-imap (0.3.4)
|
105
|
+
date
|
106
|
+
net-protocol
|
107
|
+
net-pop (0.1.2)
|
108
|
+
net-protocol
|
109
|
+
net-protocol (0.2.1)
|
110
|
+
timeout
|
111
|
+
net-smtp (0.3.3)
|
112
|
+
net-protocol
|
113
|
+
nio4r (2.5.9)
|
114
|
+
nokogiri (1.15.1-arm64-darwin)
|
115
|
+
racc (~> 1.4)
|
116
|
+
pry (0.14.2)
|
117
|
+
coderay (~> 1.1)
|
118
|
+
method_source (~> 1.0)
|
119
|
+
racc (1.6.2)
|
120
|
+
rack (2.2.7)
|
121
|
+
rack-test (2.1.0)
|
122
|
+
rack (>= 1.3)
|
123
|
+
rails (7.0.4.3)
|
124
|
+
actioncable (= 7.0.4.3)
|
125
|
+
actionmailbox (= 7.0.4.3)
|
126
|
+
actionmailer (= 7.0.4.3)
|
127
|
+
actionpack (= 7.0.4.3)
|
128
|
+
actiontext (= 7.0.4.3)
|
129
|
+
actionview (= 7.0.4.3)
|
130
|
+
activejob (= 7.0.4.3)
|
131
|
+
activemodel (= 7.0.4.3)
|
132
|
+
activerecord (= 7.0.4.3)
|
133
|
+
activestorage (= 7.0.4.3)
|
134
|
+
activesupport (= 7.0.4.3)
|
135
|
+
bundler (>= 1.15.0)
|
136
|
+
railties (= 7.0.4.3)
|
137
|
+
rails-dom-testing (2.0.3)
|
138
|
+
activesupport (>= 4.2.0)
|
139
|
+
nokogiri (>= 1.6)
|
140
|
+
rails-html-sanitizer (1.5.0)
|
141
|
+
loofah (~> 2.19, >= 2.19.1)
|
142
|
+
railties (7.0.4.3)
|
143
|
+
actionpack (= 7.0.4.3)
|
144
|
+
activesupport (= 7.0.4.3)
|
145
|
+
method_source
|
146
|
+
rake (>= 12.2)
|
147
|
+
thor (~> 1.0)
|
148
|
+
zeitwerk (~> 2.5)
|
149
|
+
rake (13.0.6)
|
150
|
+
sqlite3 (1.6.3-arm64-darwin)
|
151
|
+
thor (1.2.2)
|
152
|
+
timeout (0.3.2)
|
153
|
+
tzinfo (2.0.6)
|
154
|
+
concurrent-ruby (~> 1.0)
|
155
|
+
websocket-driver (0.7.5)
|
156
|
+
websocket-extensions (>= 0.1.0)
|
157
|
+
websocket-extensions (0.1.5)
|
158
|
+
zeitwerk (2.6.8)
|
159
|
+
|
160
|
+
PLATFORMS
|
161
|
+
arm64-darwin-22
|
162
|
+
|
163
|
+
DEPENDENCIES
|
164
|
+
appraisal
|
165
|
+
minitest
|
166
|
+
minitest-focus
|
167
|
+
minitest-spec-rails!
|
168
|
+
pry
|
169
|
+
rails (~> 7.1.0)
|
170
|
+
rake
|
171
|
+
sqlite3
|
172
|
+
|
173
|
+
BUNDLED WITH
|
174
|
+
2.4.12
|
@@ -0,0 +1,28 @@
|
|
1
|
+
unless defined?(ActionCable::Channel)
|
2
|
+
require 'action_cable/channel'
|
3
|
+
end
|
4
|
+
|
5
|
+
require 'action_cable/channel/test_case'
|
6
|
+
|
7
|
+
module MiniTestSpecRails
|
8
|
+
module Init
|
9
|
+
module ActionCableBehavior
|
10
|
+
extend ActiveSupport::Concern
|
11
|
+
|
12
|
+
included do
|
13
|
+
class_attribute :_helper_class
|
14
|
+
register_spec_type(/(Channel)( ?Test)?\z/, self)
|
15
|
+
register_spec_type(self) { |desc| desc.is_a?(Class) && desc < self }
|
16
|
+
extend Descriptions
|
17
|
+
end
|
18
|
+
|
19
|
+
module Descriptions
|
20
|
+
def described_class
|
21
|
+
determine_default_helper_class(name)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
ActionCable::Channel::TestCase.include MiniTestSpecRails::Init::ActionCableBehavior
|
@@ -7,6 +7,9 @@ module MiniTestSpecRails
|
|
7
7
|
require 'active_support'
|
8
8
|
require 'minitest-spec-rails/init/active_support'
|
9
9
|
require 'minitest-spec-rails/parallelize'
|
10
|
+
ActiveSupport.on_load(:action_cable) do
|
11
|
+
require 'minitest-spec-rails/init/action_cable'
|
12
|
+
end
|
10
13
|
ActiveSupport.on_load(:action_controller) do
|
11
14
|
require 'minitest-spec-rails/init/action_controller'
|
12
15
|
require 'minitest-spec-rails/init/action_dispatch'
|
data/minitest-spec-rails.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.authors = ['Ken Collins']
|
9
9
|
gem.email = ['ken@metaskills.net']
|
10
10
|
gem.homepage = 'http://github.com/metaskills/minitest-spec-rails'
|
11
|
-
gem.summary = 'Make Rails Use
|
11
|
+
gem.summary = 'Make Rails Use Minitest::Spec!'
|
12
12
|
gem.description = 'The minitest-spec-rails gem makes it easy to use the \
|
13
|
-
|
13
|
+
Minitest::Spec DSL within your existing Rails test suite.'
|
14
14
|
gem.license = 'MIT'
|
15
15
|
gem.files = `git ls-files`.split("\n")
|
16
16
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -19,6 +19,8 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.add_runtime_dependency 'minitest', '>= 5.0'
|
20
20
|
gem.add_runtime_dependency 'railties', '>= 4.1'
|
21
21
|
gem.add_development_dependency 'appraisal'
|
22
|
+
gem.add_development_dependency 'minitest-focus'
|
23
|
+
gem.add_development_dependency 'pry'
|
22
24
|
gem.add_development_dependency 'rake'
|
23
25
|
gem.add_development_dependency 'sqlite3'
|
24
26
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ModelsChannel < ApplicationCable::Channel; end
|
4
|
+
|
5
|
+
class ActionCableChannelTest < MiniTestSpecRails::TestCase
|
6
|
+
it 'matches spec type for class constants' do
|
7
|
+
assert_channel_test Minitest::Spec.spec_type(ApplicationCable::Channel)
|
8
|
+
assert_channel_test Minitest::Spec.spec_type(ModelsChannel)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'matches spec type for strings' do
|
12
|
+
assert_channel_test Minitest::Spec.spec_type('WidgetChannel')
|
13
|
+
assert_channel_test Minitest::Spec.spec_type('WidgetChannelTest')
|
14
|
+
assert_channel_test Minitest::Spec.spec_type('Widget Channel Test')
|
15
|
+
# And is case sensitive
|
16
|
+
refute_channel_test Minitest::Spec.spec_type('widgetcontroller')
|
17
|
+
refute_channel_test Minitest::Spec.spec_type('widgetcontrollertest')
|
18
|
+
refute_channel_test Minitest::Spec.spec_type('widget controller test')
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'wont match spec type for non space characters' do
|
22
|
+
refute_channel_test Minitest::Spec.spec_type("Widget Channel\tTest")
|
23
|
+
refute_channel_test Minitest::Spec.spec_type("Widget Channel\rTest")
|
24
|
+
refute_channel_test Minitest::Spec.spec_type("Widget Channel\nTest")
|
25
|
+
refute_channel_test Minitest::Spec.spec_type("Widget Channel\fTest")
|
26
|
+
refute_channel_test Minitest::Spec.spec_type('Widget ChannelXTest')
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def assert_channel_test(actual)
|
32
|
+
assert_equal ActionCable::Channel::TestCase, actual
|
33
|
+
end
|
34
|
+
|
35
|
+
def refute_channel_test(actual)
|
36
|
+
refute_equal ActionCable::Channel::TestCase, actual
|
37
|
+
end
|
38
|
+
end
|
@@ -4,26 +4,26 @@ class ModelsController < ApplicationController; end
|
|
4
4
|
|
5
5
|
class ActionControllerTest < MiniTestSpecRails::TestCase
|
6
6
|
it 'matches spec type for class constants' do
|
7
|
-
assert_controller
|
8
|
-
assert_controller
|
7
|
+
assert_controller Minitest::Spec.spec_type(ApplicationController)
|
8
|
+
assert_controller Minitest::Spec.spec_type(ModelsController)
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'matches spec type for strings' do
|
12
|
-
assert_controller
|
13
|
-
assert_controller
|
14
|
-
assert_controller
|
12
|
+
assert_controller Minitest::Spec.spec_type('WidgetController')
|
13
|
+
assert_controller Minitest::Spec.spec_type('WidgetControllerTest')
|
14
|
+
assert_controller Minitest::Spec.spec_type('Widget Controller Test')
|
15
15
|
# And is case sensitive
|
16
|
-
refute_controller
|
17
|
-
refute_controller
|
18
|
-
refute_controller
|
16
|
+
refute_controller Minitest::Spec.spec_type('widgetcontroller')
|
17
|
+
refute_controller Minitest::Spec.spec_type('widgetcontrollertest')
|
18
|
+
refute_controller Minitest::Spec.spec_type('widget controller test')
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'wont match spec type for non space characters' do
|
22
|
-
refute_controller
|
23
|
-
refute_controller
|
24
|
-
refute_controller
|
25
|
-
refute_controller
|
26
|
-
refute_controller
|
22
|
+
refute_controller Minitest::Spec.spec_type("Widget Controller\tTest")
|
23
|
+
refute_controller Minitest::Spec.spec_type("Widget Controller\rTest")
|
24
|
+
refute_controller Minitest::Spec.spec_type("Widget Controller\nTest")
|
25
|
+
refute_controller Minitest::Spec.spec_type("Widget Controller\fTest")
|
26
|
+
refute_controller Minitest::Spec.spec_type('Widget ControllerXTest')
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|
@@ -4,35 +4,35 @@ class ModelsController < ApplicationController; end
|
|
4
4
|
|
5
5
|
class ActionControllerTest < MiniTestSpecRails::TestCase
|
6
6
|
it 'resolves spec type for matching acceptance strings' do
|
7
|
-
assert_dispatch
|
8
|
-
assert_dispatch
|
7
|
+
assert_dispatch Minitest::Spec.spec_type('WidgetAcceptanceTest')
|
8
|
+
assert_dispatch Minitest::Spec.spec_type('Widget Acceptance Test')
|
9
9
|
# And is case sensitive
|
10
|
-
refute_dispatch
|
11
|
-
refute_dispatch
|
10
|
+
refute_dispatch Minitest::Spec.spec_type('widgetacceptancetest')
|
11
|
+
refute_dispatch Minitest::Spec.spec_type('widget acceptance test')
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'wont match spec type for space characters in acceptance strings' do
|
15
|
-
refute_dispatch
|
16
|
-
refute_dispatch
|
17
|
-
refute_dispatch
|
18
|
-
refute_dispatch
|
19
|
-
refute_dispatch
|
15
|
+
refute_dispatch Minitest::Spec.spec_type("Widget Acceptance\tTest")
|
16
|
+
refute_dispatch Minitest::Spec.spec_type("Widget Acceptance\rTest")
|
17
|
+
refute_dispatch Minitest::Spec.spec_type("Widget Acceptance\nTest")
|
18
|
+
refute_dispatch Minitest::Spec.spec_type("Widget Acceptance\fTest")
|
19
|
+
refute_dispatch Minitest::Spec.spec_type('Widget AcceptanceXTest')
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'resolves spec type for matching integration strings' do
|
23
|
-
assert_dispatch
|
24
|
-
assert_dispatch
|
23
|
+
assert_dispatch Minitest::Spec.spec_type('WidgetIntegrationTest')
|
24
|
+
assert_dispatch Minitest::Spec.spec_type('Widget Integration Test')
|
25
25
|
# And is case sensitive
|
26
|
-
refute_dispatch
|
27
|
-
refute_dispatch
|
26
|
+
refute_dispatch Minitest::Spec.spec_type('widgetintegrationtest')
|
27
|
+
refute_dispatch Minitest::Spec.spec_type('widget integration test')
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'wont match spec type for space characters in integration strings' do
|
31
|
-
refute_dispatch
|
32
|
-
refute_dispatch
|
33
|
-
refute_dispatch
|
34
|
-
refute_dispatch
|
35
|
-
refute_dispatch
|
31
|
+
refute_dispatch Minitest::Spec.spec_type("Widget Integration\tTest")
|
32
|
+
refute_dispatch Minitest::Spec.spec_type("Widget Integration\rTest")
|
33
|
+
refute_dispatch Minitest::Spec.spec_type("Widget Integration\nTest")
|
34
|
+
refute_dispatch Minitest::Spec.spec_type("Widget Integration\fTest")
|
35
|
+
refute_dispatch Minitest::Spec.spec_type('Widget IntegrationXTest')
|
36
36
|
end
|
37
37
|
|
38
38
|
private
|
@@ -5,26 +5,26 @@ class Notifications < ActionMailer::Base; end
|
|
5
5
|
|
6
6
|
class ActionMailerTest < MiniTestSpecRails::TestCase
|
7
7
|
it 'matches spec type for class constants' do
|
8
|
-
assert_mailer
|
9
|
-
assert_mailer
|
8
|
+
assert_mailer Minitest::Spec.spec_type(NotificationMailer)
|
9
|
+
assert_mailer Minitest::Spec.spec_type(Notifications)
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'matches spec type for strings' do
|
13
|
-
assert_mailer
|
14
|
-
assert_mailer
|
15
|
-
assert_mailer
|
13
|
+
assert_mailer Minitest::Spec.spec_type('WidgetMailer')
|
14
|
+
assert_mailer Minitest::Spec.spec_type('WidgetMailerTest')
|
15
|
+
assert_mailer Minitest::Spec.spec_type('Widget Mailer Test')
|
16
16
|
# And is case sensitive
|
17
|
-
refute_mailer
|
18
|
-
refute_mailer
|
19
|
-
refute_mailer
|
17
|
+
refute_mailer Minitest::Spec.spec_type('widgetmailer')
|
18
|
+
refute_mailer Minitest::Spec.spec_type('widgetmailertest')
|
19
|
+
refute_mailer Minitest::Spec.spec_type('widget mailer test')
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'wont match spec type for non space characters' do
|
23
|
-
refute_mailer
|
24
|
-
refute_mailer
|
25
|
-
refute_mailer
|
26
|
-
refute_mailer
|
27
|
-
refute_mailer
|
23
|
+
refute_mailer Minitest::Spec.spec_type("Widget Mailer\tTest")
|
24
|
+
refute_mailer Minitest::Spec.spec_type("Widget Mailer\rTest")
|
25
|
+
refute_mailer Minitest::Spec.spec_type("Widget Mailer\nTest")
|
26
|
+
refute_mailer Minitest::Spec.spec_type("Widget Mailer\fTest")
|
27
|
+
refute_mailer Minitest::Spec.spec_type('Widget MailerXTest')
|
28
28
|
end
|
29
29
|
|
30
30
|
private
|
@@ -2,31 +2,31 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class ActionViewTest < MiniTestSpecRails::TestCase
|
4
4
|
it 'resolves spec type for matching helper strings' do
|
5
|
-
assert_view
|
6
|
-
assert_view
|
7
|
-
assert_view
|
5
|
+
assert_view Minitest::Spec.spec_type('WidgetHelper')
|
6
|
+
assert_view Minitest::Spec.spec_type('WidgetHelperTest')
|
7
|
+
assert_view Minitest::Spec.spec_type('Widget Helper Test')
|
8
8
|
# And is case sensitive
|
9
|
-
refute_view
|
10
|
-
refute_view
|
11
|
-
refute_view
|
9
|
+
refute_view Minitest::Spec.spec_type('widgethelper')
|
10
|
+
refute_view Minitest::Spec.spec_type('widgethelpertest')
|
11
|
+
refute_view Minitest::Spec.spec_type('widget helper test')
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'resolves spec type for matching view strings' do
|
15
|
-
assert_view
|
16
|
-
assert_view
|
17
|
-
assert_view
|
15
|
+
assert_view Minitest::Spec.spec_type('WidgetView')
|
16
|
+
assert_view Minitest::Spec.spec_type('WidgetViewTest')
|
17
|
+
assert_view Minitest::Spec.spec_type('Widget View Test')
|
18
18
|
# And is case sensitive
|
19
|
-
refute_view
|
20
|
-
refute_view
|
21
|
-
refute_view
|
19
|
+
refute_view Minitest::Spec.spec_type('widgetview')
|
20
|
+
refute_view Minitest::Spec.spec_type('widgetviewtest')
|
21
|
+
refute_view Minitest::Spec.spec_type('widget view test')
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'wont match spec type for non space characters' do
|
25
|
-
refute_view
|
26
|
-
refute_view
|
27
|
-
refute_view
|
28
|
-
refute_view
|
29
|
-
refute_view
|
25
|
+
refute_view Minitest::Spec.spec_type("Widget Helper\tTest")
|
26
|
+
refute_view Minitest::Spec.spec_type("Widget Helper\rTest")
|
27
|
+
refute_view Minitest::Spec.spec_type("Widget Helper\nTest")
|
28
|
+
refute_view Minitest::Spec.spec_type("Widget Helper\fTest")
|
29
|
+
refute_view Minitest::Spec.spec_type('Widget HelperXTest')
|
30
30
|
end
|
31
31
|
|
32
32
|
private
|
@@ -11,26 +11,26 @@ if defined?(ActiveJob)
|
|
11
11
|
|
12
12
|
class ActiveJobTest < MiniTestSpecRails::TestCase
|
13
13
|
it 'matches spec type for class constants' do
|
14
|
-
assert_job
|
15
|
-
assert_job
|
14
|
+
assert_job Minitest::Spec.spec_type(MyJob)
|
15
|
+
assert_job Minitest::Spec.spec_type(TrashableCleanupJob)
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'matches spec type for strings' do
|
19
|
-
assert_job
|
20
|
-
assert_job
|
21
|
-
assert_job
|
19
|
+
assert_job Minitest::Spec.spec_type('WidgetJob')
|
20
|
+
assert_job Minitest::Spec.spec_type('WidgetJobTest')
|
21
|
+
assert_job Minitest::Spec.spec_type('Widget Job Test')
|
22
22
|
# And is case sensitive
|
23
|
-
refute_job
|
24
|
-
refute_job
|
25
|
-
refute_job
|
23
|
+
refute_job Minitest::Spec.spec_type('widgetmailer')
|
24
|
+
refute_job Minitest::Spec.spec_type('widgetmailertest')
|
25
|
+
refute_job Minitest::Spec.spec_type('widget mailer test')
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'wont match spec type for non space characters' do
|
29
|
-
refute_job
|
30
|
-
refute_job
|
31
|
-
refute_job
|
32
|
-
refute_job
|
33
|
-
refute_job
|
29
|
+
refute_job Minitest::Spec.spec_type("Widget Job\tTest")
|
30
|
+
refute_job Minitest::Spec.spec_type("Widget Job\rTest")
|
31
|
+
refute_job Minitest::Spec.spec_type("Widget Job\nTest")
|
32
|
+
refute_job Minitest::Spec.spec_type("Widget Job\fTest")
|
33
|
+
refute_job Minitest::Spec.spec_type('Widget JobXTest')
|
34
34
|
end
|
35
35
|
|
36
36
|
private
|
@@ -4,12 +4,12 @@ class SomeRandomModel < ActiveRecord::Base; end
|
|
4
4
|
|
5
5
|
class ActiveSupportTest < MiniTestSpecRails::TestCase
|
6
6
|
it 'resolves spec type for active record constants' do
|
7
|
-
assert_support
|
8
|
-
assert_support
|
7
|
+
assert_support Minitest::Spec.spec_type(SomeRandomModel)
|
8
|
+
assert_support Minitest::Spec.spec_type(User)
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'wont resolve spec type for random strings' do
|
12
|
-
assert_spec
|
12
|
+
assert_spec Minitest::Spec.spec_type('Unmatched String')
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
@@ -19,7 +19,7 @@ class ActiveSupportTest < MiniTestSpecRails::TestCase
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def assert_spec(actual)
|
22
|
-
assert_equal
|
22
|
+
assert_equal Minitest::Spec, actual
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -28,8 +28,8 @@ class ActiveSupportCallbackTest < ActiveSupport::TestCase
|
|
28
28
|
setup :bar
|
29
29
|
|
30
30
|
it 'works' do
|
31
|
-
@foo.must_equal 'foo'
|
32
|
-
@bar.must_equal 'bar'
|
31
|
+
expect(@foo).must_equal 'foo'
|
32
|
+
expect(@bar).must_equal 'bar'
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
@@ -45,7 +45,7 @@ end
|
|
45
45
|
|
46
46
|
class ActiveSupportSpecTest < ActiveSupport::TestCase
|
47
47
|
it 'current spec name' do
|
48
|
-
Thread.current[:current_spec].must_equal self
|
48
|
+
expect(Thread.current[:current_spec]).must_equal self
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -14,11 +14,11 @@ class PostTests < ActiveSupport::TestCase
|
|
14
14
|
end
|
15
15
|
|
16
16
|
should 'setup correctly' do
|
17
|
-
@post.must_be_instance_of Post
|
17
|
+
expect(@post).must_be_instance_of Post
|
18
18
|
end
|
19
19
|
|
20
20
|
should 'teardown correctly' do
|
21
|
-
$teardown_ran.must_equal true
|
21
|
+
expect($teardown_ran).must_equal true
|
22
22
|
end
|
23
23
|
|
24
24
|
should_eventually 'will be skipped' do
|
@@ -27,7 +27,7 @@ class PostTests < ActiveSupport::TestCase
|
|
27
27
|
|
28
28
|
context 'level 1' do
|
29
29
|
should 'work' do
|
30
|
-
@post.must_be_instance_of Post
|
30
|
+
expect(@post).must_be_instance_of Post
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -3,6 +3,6 @@ class UserMailer < ActionMailer::Base
|
|
3
3
|
|
4
4
|
def welcome(user)
|
5
5
|
@user = user
|
6
|
-
mail to: @user.email, subject: 'Welcome', body: "Welcome to
|
6
|
+
mail to: @user.email, subject: 'Welcome', body: "Welcome to Minitest::Spec #{@user.email}!"
|
7
7
|
end
|
8
8
|
end
|