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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9408e396ed2d699f0d7c87a2ff129b6c5f2054a
4
- data.tar.gz: 495b7c539331c43354e2d652f74206bbaf8be340
3
+ metadata.gz: 342a48e3db12a8cab6201515dbb13fede213619f
4
+ data.tar.gz: 77c97a7bc152f267a4a112cca7c6d5219f7bd70e
5
5
  SHA512:
6
- metadata.gz: a6113aadd99cccdd0f45345a9ed4877b88e5ffbd7d137b00c7c20f7c3cc63f5a262c627731a024cc20f424b9028cf5f61764c126c81b409a3c7d2b317bccd526
7
- data.tar.gz: 5512028271386985bd24bccf781d65597252a5a84a66ad242b27fdaa666afba433d4d88ecb028cda8c0d56d9a1169ab3f26f669b19d68be6c565f7215c8c83c3
6
+ metadata.gz: b1c5569edae61252ea18748398bd20b8d2518475972566f60370f8f99d9567181a34602b61098bed7617b800944e4048b91ff464670732d95eb024b3fbb54a37
7
+ data.tar.gz: 2d207c12753bbcd49cef976b743cfa279ef8890cab9580fc4a14b2e306996eebd0fb48702b62cbfcb833c1d174a2b4081c9e25584883606f5842fd358a82e675
@@ -1,4 +1,12 @@
1
1
 
2
+ ## 5.2.2
3
+
4
+ * Fix ActiveJob support for `described_class`. Thanks @pschambacher.
5
+
6
+ ## 5.2.1
7
+
8
+ * Only add our Thread.current[:current_spec] hack if needed. Fixes #45.
9
+
2
10
  ## 5.2.0
3
11
 
4
12
  * Added ActiveJob support. Fixes #59. Thanks @xpepermint.
data/README.md CHANGED
@@ -100,26 +100,26 @@ end
100
100
  ```ruby
101
101
  require 'test_helper'
102
102
  describe User do
103
- # This will work too, but is not recommended
103
+ # THIS IS NOT RECOMMENDED!
104
104
  end
105
105
  ```
106
106
 
107
- Just for reference, here is a full list of each of Rails test case classes and the matching describe alternative if one exists. Remember, names are important when using the describe syntax. So, you can not have a mailer named `FooBar` and expect it to work with the outer describe spec style since there is no way to map the spec type based on an existing naming convention.
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
- Using `describe` in this way [is not recommended](https://github.com/metaskills/minitest-spec-rails/issues/56).
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
- describe UsersHelper do
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 [should-context](https://github.com/thoughtbot/shoulda-context) in a few lines of code.
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 are in 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.
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/zenspider/minitest-matchers) gem. You can also check out the [valid_attribute](https://github.com/bcardarella/valid_attribute) gem built on top of minitest-matchers.
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
@@ -14,7 +14,9 @@ module MiniTestSpecRails
14
14
  module Descriptions
15
15
 
16
16
  def described_class
17
- determine_default_mailer(name)
17
+ determine_constant_from_test_name(name) do |constant|
18
+ Class === constant && constant < ActiveJob::Base
19
+ end
18
20
  end
19
21
 
20
22
  end
@@ -25,7 +25,7 @@ module MiniTestSpecRails
25
25
  def initialize(*args)
26
26
  Thread.current[:current_spec] = self
27
27
  super
28
- end
28
+ end if Minitest::VERSION < "5.3.3"
29
29
 
30
30
  end
31
31
  end
@@ -1,3 +1,3 @@
1
1
  module MiniTestSpecRails
2
- VERSION = "5.2.0"
2
+ VERSION = "5.2.2"
3
3
  end
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.0
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-01-19 00:00:00.000000000 Z
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.2
163
+ rubygems_version: 2.4.6
164
164
  signing_key:
165
165
  specification_version: 4
166
166
  summary: Make Rails Use MiniTest::Spec!