minitest-spec-rails 5.2.0 → 5.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +13 -13
- data/lib/minitest-spec-rails/init/active_job.rb +3 -1
- data/lib/minitest-spec-rails/init/active_support.rb +1 -1
- data/lib/minitest-spec-rails/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 342a48e3db12a8cab6201515dbb13fede213619f
|
4
|
+
data.tar.gz: 77c97a7bc152f267a4a112cca7c6d5219f7bd70e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1c5569edae61252ea18748398bd20b8d2518475972566f60370f8f99d9567181a34602b61098bed7617b800944e4048b91ff464670732d95eb024b3fbb54a37
|
7
|
+
data.tar.gz: 2d207c12753bbcd49cef976b743cfa279ef8890cab9580fc4a14b2e306996eebd0fb48702b62cbfcb833c1d174a2b4081c9e25584883606f5842fd358a82e675
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -100,26 +100,26 @@ end
|
|
100
100
|
```ruby
|
101
101
|
require 'test_helper'
|
102
102
|
describe User do
|
103
|
-
#
|
103
|
+
# THIS IS NOT RECOMMENDED!
|
104
104
|
end
|
105
105
|
```
|
106
106
|
|
107
|
-
|
107
|
+
RSpec 3 is also moving away from the outer describe test type inference, as described in this line from their [release notes](https://www.relishapp.com/rspec/rspec-rails/v/3-1/docs/changelog).
|
108
108
|
|
109
|
-
|
109
|
+
> Spec types are no longer inferred by location, they instead need to be explicitly tagged. The old behaviour is enabled by config.infer_spec_type_from_file_location!, which is still supplied in the default generated spec_helper.rb. (Xavier Shay, Myron Marston)
|
110
|
+
|
111
|
+
Not that we want to mimic RSpec, but the aim of this gem is very straight forward and minimilistic. We simply want to expose the Minitest Spec::DSL and core assertion style within ActiveSupport. Period. So it is very possible that us matching outer describe to classes is simply going to go away one day soon.
|
112
|
+
|
113
|
+
Just for reference, here is a full list of each of Rails test case we support.
|
110
114
|
|
111
115
|
```ruby
|
112
116
|
# Model Test (or anything else not listed below)
|
113
117
|
class UserTest < ActiveSupport::TestCase
|
114
118
|
end
|
115
|
-
describe User do
|
116
|
-
end
|
117
119
|
|
118
120
|
# Controller Test
|
119
121
|
class UsersControllerTest < ActionController::TestCase
|
120
122
|
end
|
121
|
-
describe UsersController do
|
122
|
-
end
|
123
123
|
|
124
124
|
# Integration Tests - Must use subclass style!
|
125
125
|
class IntegrationTest < ActionDispatch::IntegrationTest
|
@@ -128,13 +128,13 @@ end
|
|
128
128
|
# Mailer Test
|
129
129
|
class UserMailerTest < ActionMailer::TestCase
|
130
130
|
end
|
131
|
-
describe UserMailer do
|
132
|
-
end
|
133
131
|
|
134
132
|
# View Helper Test
|
135
133
|
class UsersHelperTest < ActionView::TestCase
|
136
134
|
end
|
137
|
-
|
135
|
+
|
136
|
+
# Job Helper Test
|
137
|
+
class MyJobTest < ActiveJob::TestCase
|
138
138
|
end
|
139
139
|
```
|
140
140
|
|
@@ -194,7 +194,7 @@ If you are migrating away from Shoulda, then minitest-spec-rails' mini_shoulda f
|
|
194
194
|
config.minitest_spec_rails.mini_shoulda = true
|
195
195
|
```
|
196
196
|
|
197
|
-
Doing so only enables a few aliases that allow the Shoulda `context`, `should`, and `should_eventually` methods. The following code demonstrates the full features of the mini_shoulda implementation. It basically replaces the shell of [
|
197
|
+
Doing so only enables a few aliases that allow the Shoulda `context`, `should`, and `should_eventually` methods. The following code demonstrates the full features of the mini_shoulda implementation. It basically replaces the shell of [shoulda-context](https://github.com/thoughtbot/shoulda-context) in a few lines of code.
|
198
198
|
|
199
199
|
```ruby
|
200
200
|
class PostTests < ActiveSupport::TestCase
|
@@ -211,7 +211,7 @@ class PostTests < ActiveSupport::TestCase
|
|
211
211
|
end
|
212
212
|
```
|
213
213
|
|
214
|
-
If you
|
214
|
+
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.
|
215
215
|
|
216
216
|
```ruby
|
217
217
|
assert_same_elements a, b # From
|
@@ -223,7 +223,7 @@ a.wont_include b # To
|
|
223
223
|
|
224
224
|
### Matchers
|
225
225
|
|
226
|
-
**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/
|
226
|
+
**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.
|
227
227
|
|
228
228
|
```ruby
|
229
229
|
describe Post do
|
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: 5.2.
|
4
|
+
version: 5.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Collins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
160
|
version: '0'
|
161
161
|
requirements: []
|
162
162
|
rubyforge_project:
|
163
|
-
rubygems_version: 2.4.
|
163
|
+
rubygems_version: 2.4.6
|
164
164
|
signing_key:
|
165
165
|
specification_version: 4
|
166
166
|
summary: Make Rails Use MiniTest::Spec!
|