minitest-spec-rails 4.3.5 → 4.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,9 @@
1
1
 
2
+ ## v4.3.6
3
+
4
+ * Only require the freedom patches and autorun when Rails.env.test?
5
+
6
+
2
7
  ## v4.3.5
3
8
 
4
9
  * Make sure #described_class works in ActiveSupport::TestCase class level.
data/README.md CHANGED
@@ -155,20 +155,9 @@ a.wont_include b # To
155
155
 
156
156
  ### Matchers
157
157
 
158
- If matchers are your thing, I recommend the [minitest-matchers](https://github.com/zenspider/minitest-matchers) gem. For example:
158
+ **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.
159
159
 
160
160
  ```ruby
161
- # Basic minitest-matchers features.
162
- describe Post do
163
- include ValidAttribute::Method
164
- it "must have validations" do
165
- post = Post.new
166
- post.must have_valid(:title).when("Good")
167
- post.wont have_valid(:title).when("")
168
- end
169
- end
170
-
171
- # Using an implicit subject.
172
161
  describe Post do
173
162
  subject { Post.new }
174
163
  it { must have_valid(:title).when("Hello") }
@@ -176,18 +165,6 @@ describe Post do
176
165
  end
177
166
  ```
178
167
 
179
- Want more? Try out the [valid_attribute](https://github.com/bcardarella/valid_attribute) gem built on top of minitest-matchers.
180
-
181
- ```ruby
182
- describe User do
183
- subject { User.new }
184
- it { must have_valid(:email).when('test@test.com', 'test+spam@gmail.com') }
185
- it { wont have_valid(:email).when('fail', 123) }
186
- it { must have_valid(:name).when('TestName') }
187
- it { wont have_valid(:name).when('Test') }
188
- end
189
- ```
190
-
191
168
 
192
169
  ## Gotchas
193
170
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/kencollins/Repositories/minitest-spec-rails
3
3
  specs:
4
- minitest-spec-rails (4.3.4)
4
+ minitest-spec-rails (4.3.6)
5
5
  minitest (~> 4.3)
6
6
  rails (>= 3.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/kencollins/Repositories/minitest-spec-rails
3
3
  specs:
4
- minitest-spec-rails (4.3.4)
4
+ minitest-spec-rails (4.3.6)
5
5
  minitest (~> 4.3)
6
6
  rails (>= 3.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/kencollins/Repositories/minitest-spec-rails
3
3
  specs:
4
- minitest-spec-rails (4.3.5)
4
+ minitest-spec-rails (4.3.6)
5
5
  minitest (~> 4.3)
6
6
  rails (>= 3.0)
7
7
 
@@ -43,7 +43,7 @@ GIT
43
43
  PATH
44
44
  remote: /Users/kencollins/Repositories/minitest-spec-rails
45
45
  specs:
46
- minitest-spec-rails (4.3.5)
46
+ minitest-spec-rails (4.3.6)
47
47
  minitest (~> 4.3)
48
48
  rails (>= 3.0)
49
49
 
@@ -4,23 +4,28 @@ module MiniTestSpecRails
4
4
  config.minitest_spec_rails = ActiveSupport::OrderedOptions.new
5
5
  config.minitest_spec_rails.mini_shoulda = false
6
6
 
7
- config.before_initialize do |app|
8
- ActiveSupport.on_load(:action_view) do
9
- require 'minitest-spec-rails/init/action_view'
10
- end
11
- ActiveSupport.on_load(:action_controller) do
12
- require 'minitest-spec-rails/init/action_controller'
13
- require 'action_dispatch/testing/integration' # For Rails 3.0 loading.
14
- require 'minitest-spec-rails/init/action_dispatch'
15
- end
16
- ActiveSupport.on_load(:action_mailer) do
17
- require 'minitest-spec-rails/init/action_mailer'
7
+ config.before_initialize do |app|
8
+ if Rails.env.test?
9
+ ActiveSupport.on_load(:action_view) do
10
+ require 'minitest-spec-rails/init/action_view'
11
+ end
12
+ ActiveSupport.on_load(:action_controller) do
13
+ require 'minitest-spec-rails/init/action_controller'
14
+ require 'action_dispatch/testing/integration' # For Rails 3.0 loading.
15
+ require 'minitest-spec-rails/init/action_dispatch'
16
+ end
17
+ ActiveSupport.on_load(:action_mailer) do
18
+ require 'minitest-spec-rails/init/action_mailer'
19
+ end
18
20
  end
19
21
  end
20
22
 
21
23
  initializer 'minitest-spec-rails.after.load_active_support', :after => :load_active_support, :group => :all do |app|
22
- require 'minitest-spec-rails/init/active_support'
23
- require 'minitest-spec-rails/init/mini_shoulda' if app.config.minitest_spec_rails.mini_shoulda
24
+ if Rails.env.test?
25
+ require 'minitest-spec-rails/init/active_support'
26
+ require 'minitest-spec-rails/init/mini_shoulda' if app.config.minitest_spec_rails.mini_shoulda
27
+ require 'minitest/autorun'
28
+ end
24
29
  end
25
30
 
26
31
  end
@@ -1,3 +1,3 @@
1
1
  module MiniTestSpecRails
2
- VERSION = "4.3.5"
2
+ VERSION = "4.3.6"
3
3
  end
@@ -1,5 +1,4 @@
1
1
  require 'minitest-spec-rails'
2
- require 'minitest/autorun'
3
2
  require 'pp'
4
3
 
5
4
  module Test
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.5
4
+ version: 4.3.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -188,7 +188,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
188
  version: '0'
189
189
  segments:
190
190
  - 0
191
- hash: -3446977262078357422
191
+ hash: -4017184402848978979
192
192
  required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  version: '0'
198
198
  segments:
199
199
  - 0
200
- hash: -3446977262078357422
200
+ hash: -4017184402848978979
201
201
  requirements: []
202
202
  rubyforge_project:
203
203
  rubygems_version: 1.8.24