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.
- data/CHANGELOG.md +5 -0
- data/README.md +1 -24
- data/gemfiles/rails30.gemfile.lock +1 -1
- data/gemfiles/rails31.gemfile.lock +1 -1
- data/gemfiles/rails32.gemfile.lock +1 -1
- data/gemfiles/rails40.gemfile.lock +1 -1
- data/lib/minitest-spec-rails/railtie.rb +18 -13
- data/lib/minitest-spec-rails/version.rb +1 -1
- data/lib/test/unit/testcase.rb +0 -1
- metadata +3 -3
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -155,20 +155,9 @@ a.wont_include b # To
|
|
155
155
|
|
156
156
|
### Matchers
|
157
157
|
|
158
|
-
|
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
|
|
@@ -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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
-
|
23
|
-
|
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
|
data/lib/test/unit/testcase.rb
CHANGED
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.
|
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: -
|
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: -
|
200
|
+
hash: -4017184402848978979
|
201
201
|
requirements: []
|
202
202
|
rubyforge_project:
|
203
203
|
rubygems_version: 1.8.24
|