minitest-spec-rails 7.0.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/CHANGELOG.md +6 -0
- data/README.md +13 -13
- data/gemfiles/rails_v6.0.x.gemfile.lock +1 -1
- data/gemfiles/rails_v6.1.x.gemfile.lock +1 -1
- data/gemfiles/rails_v7.0.x.gemfile.lock +2 -2
- data/lib/minitest-spec-rails/init/action_cable.rb +4 -1
- data/lib/minitest-spec-rails/init/active_support.rb +1 -1
- data/lib/minitest-spec-rails/version.rb +1 -1
- data/minitest-spec-rails.gemspec +2 -2
- data/test/cases/action_cable_test.rb +13 -13
- 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 +4 -4
- 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_tests/application_controller_test.rb +2 -2
- data/test/dummy_tests/user_mailer_test.rb +1 -1
- data/test/test_helper.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a2989f1706a0168c45d78e39ab60653fd2bfa474b35da44baf10a3c96a6bafc
|
4
|
+
data.tar.gz: 1bf80ba6ff70170f2ade4032752a119ae50e71c5ef9088d2bb0433801e478ed6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69bde3a701acbb80be35241215857814b7dd1511e50a7b83c0035a3c8ee157eee9787271100bb59123cf8906feb0e023d0bbae9dd664ec27f3cd2af45329b8a0
|
7
|
+
data.tar.gz: a272548e1b379d1e378e924ad8173986961746678e37a34f390f8543bada37fd4537b9f271e0af735c357f222ee8c805ec4ae477ebc8eb1c07a76a996098fc92
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 7.1.0
|
2
|
+
|
3
|
+
- Use Minitest instead of MiniTest. Fixes #119. Thanks @evgeni
|
4
|
+
- Fix ActionCable::Channel::TestCase support. Fixes #118. Thanks @marcoroth
|
5
|
+
- Add support for ActionCable::Channel::TestCase. Fixes #117. Thanks @tijn
|
6
|
+
|
1
7
|
## 7.0.0
|
2
8
|
|
3
9
|
- Add support for ActionCable::Channel::TestCase. Fixed #117. Thanks @tijn
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
<a href="https://dhh.dk/2012/rails-is-omakase.html"><img src="https://user-images.githubusercontent.com/2381/34084174-246174da-e34a-11e7-9d36-94c9cde7b63d.png" width="233" height="154" /></a>
|
2
2
|
|
3
|
-
# Make Rails Use
|
3
|
+
# Make Rails Use Minitest::Spec!
|
4
4
|
##### https://dhh.dk/2012/rails-is-omakase.html
|
5
5
|
|
6
|
-
The minitest-spec-rails gem makes it easy to use the
|
6
|
+
The minitest-spec-rails gem makes it easy to use the Minitest::Spec DSL within your existing Rails 2.3, 3.x or 4.x test suite. It does this by forcing ActiveSupport::TestCase to utilize the Minitest::Spec::DSL.
|
7
7
|
|
8
8
|
[![Gem Version](https://badge.fury.io/rb/minitest-spec-rails.svg)](http://badge.fury.io/rb/minitest-spec-rails)
|
9
9
|
[![CI Status](https://github.com/metaskills/minitest-spec-rails/workflows/CI/badge.svg)](https://launch-editor.github.com/actions?nwo=metaskills%2Fminitest-spec-rails&workflowID=CI)
|
@@ -12,7 +12,7 @@ The minitest-spec-rails gem makes it easy to use the MiniTest::Spec DSL within y
|
|
12
12
|
|
13
13
|
## Usage
|
14
14
|
|
15
|
-
Existing or new Rails applications that use the default Rails testing structure can simply drop in the minitest-spec-gem and start writing their tests in the new spec DSL. Since
|
15
|
+
Existing or new Rails applications that use the default Rails testing structure can simply drop in the minitest-spec-gem and start writing their tests in the new spec DSL. Since Minitest::Spec is built on top of Minitest::Unit, a replacement for Test::Unit, all of your existing tests will continue to work.
|
16
16
|
|
17
17
|
|
18
18
|
#### Rails 4.1 to 6.0
|
@@ -36,9 +36,9 @@ end
|
|
36
36
|
```
|
37
37
|
|
38
38
|
|
39
|
-
### How is this different than
|
39
|
+
### How is this different than Minitest::Rails?
|
40
40
|
|
41
|
-
To start off both Mike Moore (@blowmage) and I have worked together and we both LOVE
|
41
|
+
To start off both Mike Moore (@blowmage) and I have worked together and we both LOVE Minitest::Spec. Both projects aim to advocate Minitest and make Rails integration as easy as possible. However, there are a few key differences in our projects. Some of these differences may go away in time too. As always, choose the tool you think fits your needs. So how, is minitest-spec-rails different than [minitest-rails](https://github.com/blowmage/minitest-rails)?
|
42
42
|
|
43
43
|
* We aim to leverage existing Rails test directories and files!
|
44
44
|
* No special test helper and/or generators.
|
@@ -47,7 +47,7 @@ To start off both Mike Moore (@blowmage) and I have worked together and we both
|
|
47
47
|
* Fully support Ruby 1.8.7 with all legacy Test::Unit behavior.
|
48
48
|
* Compatibility with ActiveSupport::TestCase's setup and teardowns.
|
49
49
|
|
50
|
-
So the goal of this project is to make Rails 3 or 4 applications just work as if rails-core had decided to support
|
50
|
+
So the goal of this project is to make Rails 3 or 4 applications just work as if rails-core had decided to support Minitest::Spec all along. We believe that eventually that day will come and when it does, all your tests will still work! So bundle up and get started!
|
51
51
|
|
52
52
|
```ruby
|
53
53
|
gem 'minitest-spec-rails'
|
@@ -56,13 +56,13 @@ gem 'minitest-spec-rails'
|
|
56
56
|
|
57
57
|
## Test Styles
|
58
58
|
|
59
|
-
This <a href="https://chriskottom.com/freebies/cheatsheets_free.pdf">cheat sheet</a> shows both the
|
59
|
+
This <a href="https://chriskottom.com/freebies/cheatsheets_free.pdf">cheat sheet</a> shows both the Minitest::Unit assertions along with the Minitest::Spec assertion syntax. Remember, Minitest::Spec is built on top of Minitest::Unit which is a Test::Unit replacement. That means you can mix and match styles as you upgrade from Test::Unit to a more modern style. For example, both of these would work in Minitest::Spec and are interchangeable.
|
60
60
|
|
61
61
|
```ruby
|
62
|
-
#
|
62
|
+
# Minitest::Unit Assertion Style:
|
63
63
|
assert_equal 100, foo
|
64
64
|
|
65
|
-
#
|
65
|
+
# Minitest::Spec Assertion Style:
|
66
66
|
expect(foo).must_equal 100
|
67
67
|
```
|
68
68
|
|
@@ -191,7 +191,7 @@ class PostTests < ActiveSupport::TestCase
|
|
191
191
|
end
|
192
192
|
```
|
193
193
|
|
194
|
-
If you prefer the assertions provided by shoulda-context like `assert_same_elements`, then you may want to consider copying them [from here](https://github.com/thoughtbot/shoulda-context/blob/master/lib/shoulda/context/assertions.rb) and including them in `
|
194
|
+
If you prefer the assertions provided by shoulda-context like `assert_same_elements`, then you may want to consider copying them [from here](https://github.com/thoughtbot/shoulda-context/blob/master/lib/shoulda/context/assertions.rb) and including them in `Minitest::Spec` yourself. I personally recommend just replacing these assertions with something more modern. A few examples are below.
|
195
195
|
|
196
196
|
```ruby
|
197
197
|
assert_same_elements a, b # From
|
@@ -203,7 +203,7 @@ expect(a).wont_include b # To
|
|
203
203
|
|
204
204
|
### Matchers
|
205
205
|
|
206
|
-
**I highly suggest that you stay away from matchers** since
|
206
|
+
**I highly suggest that you stay away from matchers** since Minitest::Spec gives you all the tools you need to write good tests. Staying away from matchers will make your code's tests live longer. So my advice is to stay away from things like `.should ==` and just write `.must_equal` instead. However, if matchers are really your thing, I recommend the [minitest-matchers](https://github.com/wojtekmach/minitest-matchers) gem. You can also check out the [valid_attribute](https://github.com/bcardarella/valid_attribute) gem built on top of minitest-matchers.
|
207
207
|
|
208
208
|
```ruby
|
209
209
|
describe Post do
|
@@ -229,14 +229,14 @@ end
|
|
229
229
|
|
230
230
|
### Assertion Methods
|
231
231
|
|
232
|
-
If you are upgrading from Test::Unit, there are a few missing assertions that have been renamed or are no longer available within
|
232
|
+
If you are upgrading from Test::Unit, there are a few missing assertions that have been renamed or are no longer available within Minitest.
|
233
233
|
|
234
234
|
* The method `assert_raise` is renamed `assert_raises`.
|
235
235
|
* There is no method `assert_nothing_raised`. There are good reasons for this on [Ryan's blog entry](http://blog.zenspider.com/blog/2012/01/assert_nothing_tested.html).
|
236
236
|
|
237
237
|
### Mocha
|
238
238
|
|
239
|
-
If you are using [Mocha](https://github.com/freerange/mocha) for mocking and stubbing, please update to the latest, 0.13.1 or higher so it is compatible with the latest
|
239
|
+
If you are using [Mocha](https://github.com/freerange/mocha) for mocking and stubbing, please update to the latest, 0.13.1 or higher so it is compatible with the latest Minitest. If you do not like the deprecation warnings in older versions of Rails, just add this below the `require 'rails/all'` within your `application.rb` file :)
|
240
240
|
|
241
241
|
```ruby
|
242
242
|
require 'mocha/deprecation'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
minitest-spec-rails (7.
|
4
|
+
minitest-spec-rails (7.1.0)
|
5
5
|
minitest (>= 5.0)
|
6
6
|
railties (>= 4.1)
|
7
7
|
|
@@ -166,7 +166,7 @@ DEPENDENCIES
|
|
166
166
|
minitest-focus
|
167
167
|
minitest-spec-rails!
|
168
168
|
pry
|
169
|
-
rails (~> 7.
|
169
|
+
rails (~> 7.1.0)
|
170
170
|
rake
|
171
171
|
sqlite3
|
172
172
|
|
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")
|
@@ -4,26 +4,26 @@ class ModelsChannel < ApplicationCable::Channel; end
|
|
4
4
|
|
5
5
|
class ActionCableChannelTest < MiniTestSpecRails::TestCase
|
6
6
|
it 'matches spec type for class constants' do
|
7
|
-
assert_channel_test
|
8
|
-
assert_channel_test
|
7
|
+
assert_channel_test Minitest::Spec.spec_type(ApplicationCable::Channel)
|
8
|
+
assert_channel_test Minitest::Spec.spec_type(ModelsChannel)
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'matches spec type for strings' do
|
12
|
-
assert_channel_test
|
13
|
-
assert_channel_test
|
14
|
-
assert_channel_test
|
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
15
|
# And is case sensitive
|
16
|
-
refute_channel_test
|
17
|
-
refute_channel_test
|
18
|
-
refute_channel_test
|
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
19
|
end
|
20
20
|
|
21
21
|
it 'wont match spec type for non space characters' do
|
22
|
-
refute_channel_test
|
23
|
-
refute_channel_test
|
24
|
-
refute_channel_test
|
25
|
-
refute_channel_test
|
26
|
-
refute_channel_test
|
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
27
|
end
|
28
28
|
|
29
29
|
private
|
@@ -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
|
|
@@ -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
|
@@ -7,11 +7,11 @@ module ApplicationControllerTests
|
|
7
7
|
|
8
8
|
it 'works' do
|
9
9
|
get :index
|
10
|
-
expect(response.body).must_equal '<h1>Rendered
|
10
|
+
expect(response.body).must_equal '<h1>Rendered Minitest::Spec</h1>'
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'allows custom assertions' do
|
14
|
-
assert_select 'h1', text: 'Rendered
|
14
|
+
assert_select 'h1', text: 'Rendered Minitest::Spec'
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'can find the controller_class' do
|
@@ -17,7 +17,7 @@ module UserMailerTests
|
|
17
17
|
expect(deliveries).wont_be :empty?
|
18
18
|
expect(user_email.to).must_equal [user_ken.email]
|
19
19
|
expect(user_email.from).must_equal ['rails@minitest.spec']
|
20
|
-
expect(user_email.body.encoded).must_equal "Welcome to
|
20
|
+
expect(user_email.body.encoded).must_equal "Welcome to Minitest::Spec #{user_ken.email}!"
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'allows custom assertions' do
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-spec-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Collins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -110,7 +110,7 @@ dependencies:
|
|
110
110
|
version: '0'
|
111
111
|
description: |-
|
112
112
|
The minitest-spec-rails gem makes it easy to use the \
|
113
|
-
|
113
|
+
Minitest::Spec DSL within your existing Rails test suite.
|
114
114
|
email:
|
115
115
|
- ken@metaskills.net
|
116
116
|
executables: []
|
@@ -206,10 +206,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
206
|
- !ruby/object:Gem::Version
|
207
207
|
version: '0'
|
208
208
|
requirements: []
|
209
|
-
rubygems_version: 3.
|
209
|
+
rubygems_version: 3.4.6
|
210
210
|
signing_key:
|
211
211
|
specification_version: 4
|
212
|
-
summary: Make Rails Use
|
212
|
+
summary: Make Rails Use Minitest::Spec!
|
213
213
|
test_files:
|
214
214
|
- test/cases/action_cable_test.rb
|
215
215
|
- test/cases/action_controller_test.rb
|