minitest-spec-rails 4.7.3 → 4.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Appraisals +1 -1
- data/README.md +2 -12
- data/lib/minitest-spec-rails/init/action_controller.rb +1 -1
- data/lib/minitest-spec-rails/init/action_dispatch.rb +1 -1
- data/lib/minitest-spec-rails/init/action_mailer.rb +1 -1
- data/lib/minitest-spec-rails/init/action_view.rb +2 -2
- data/lib/minitest-spec-rails/version.rb +1 -1
- data/minitest-spec-rails.gemspec +1 -1
- data/test/cases/action_controller_test.rb +4 -4
- data/test/cases/action_dispatch_test.rb +30 -28
- data/test/cases/action_mailer_test.rb +4 -4
- data/test/cases/action_view_test.rb +8 -8
- data/test/dummy_app/app/helpers/foos_helper.rb +6 -0
- data/test/dummy_tests/foo_helper_test.rb +7 -0
- metadata +13 -18
data/Appraisals
CHANGED
data/README.md
CHANGED
@@ -16,7 +16,7 @@ The minitest-spec-rails gem makes it easy to use the MiniTest::Spec DSL within y
|
|
16
16
|
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 MinitTest::Spec is built on top of MiniTest::Unit, a replacement for Test::Unit, all of your existing tests will continue to work.
|
17
17
|
|
18
18
|
|
19
|
-
#### For Rails 3
|
19
|
+
#### For Rails 3.x
|
20
20
|
|
21
21
|
```ruby
|
22
22
|
group :test do
|
@@ -24,16 +24,6 @@ group :test do
|
|
24
24
|
end
|
25
25
|
```
|
26
26
|
|
27
|
-
#### For Rails 2.3
|
28
|
-
|
29
|
-
Our [2-3-stable](https://github.com/metaskills/minitest-spec-rails/tree/2-3-stable) branch tracks our 3.1 version number and is guaranteed to work on any Rails 2.3 version. Since Rails 2.3 does not have a configurable Railtie, we have enabled the [mini-shoulda](#mini_shoulda) option all the time. This means that if you are on Rails 2.3 under either Ruby 1.8 or 1.9, perhaps using Shoulda, you have a solid upgrade path! Get your tests running with minitest-spec-rails first and nothing in you test stack changes along the way!
|
30
|
-
|
31
|
-
```ruby
|
32
|
-
group :test do
|
33
|
-
gem 'minitest-spec-rails', '~> 3.1'
|
34
|
-
end
|
35
|
-
```
|
36
|
-
|
37
27
|
#### Ruby 1.8 Users!!!
|
38
28
|
|
39
29
|
If you are using Ruby 1.8, you must install a Test::Unit shim that subclasses MiniTest::Unit, just as Ruby 1.9 does. We have kindly packed up Ruby 1.9's `lib/test` directory in the [minitest-spec-rails-tu-shim](https://github.com/metaskills/minitest-spec-rails-tu-shim) gem. So just add this to your Gemfile.
|
@@ -256,7 +246,7 @@ end
|
|
256
246
|
|
257
247
|
## Contributing
|
258
248
|
|
259
|
-
The minitest-spec-rails gem is fully tested
|
249
|
+
The minitest-spec-rails gem is fully tested for minor Rails 3.x versions. We run our tests on [Travis CI](http://travis-ci.org/metaskills/minitest-spec-rails) in both Ruby 1.8 and 1.9. If you detect a problem, open up a github issue or fork the repo and help out. After you fork or clone the repository, the following commands will get you up and running on the test suite.
|
260
250
|
|
261
251
|
```shell
|
262
252
|
$ bundle install
|
@@ -6,7 +6,7 @@ module MiniTestSpecRails
|
|
6
6
|
|
7
7
|
included do
|
8
8
|
register_spec_type(self) { |desc| Class === desc && desc < ActionController::Metal }
|
9
|
-
register_spec_type(/Controller( ?Test)?\z
|
9
|
+
register_spec_type(/Controller( ?Test)?\z/, self)
|
10
10
|
register_spec_type(self) { |desc| Class === desc && desc < self }
|
11
11
|
register_rails_test_case self
|
12
12
|
end
|
@@ -5,7 +5,7 @@ module MiniTestSpecRails
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
7
|
included do
|
8
|
-
register_spec_type(/(Acceptance|Integration) ?Test\z
|
8
|
+
register_spec_type(/(Acceptance|Integration) ?Test\z/, self)
|
9
9
|
register_spec_type(self) { |desc| Class === desc && desc < self }
|
10
10
|
register_rails_test_case self
|
11
11
|
end
|
@@ -6,7 +6,7 @@ module MiniTestSpecRails
|
|
6
6
|
|
7
7
|
included do
|
8
8
|
register_spec_type(self) { |desc| Class === desc && desc < ActionMailer::Base }
|
9
|
-
register_spec_type(/Mailer( ?Test)?\z
|
9
|
+
register_spec_type(/Mailer( ?Test)?\z/, self)
|
10
10
|
register_spec_type(self) { |desc| Class === desc && desc < self }
|
11
11
|
register_rails_test_case self
|
12
12
|
before { setup_minitest_spec_rails_mailer_class }
|
@@ -6,7 +6,7 @@ module MiniTestSpecRails
|
|
6
6
|
|
7
7
|
included do
|
8
8
|
class_attribute :_helper_class
|
9
|
-
register_spec_type(/(Helper|View)( ?Test)?\z
|
9
|
+
register_spec_type(/(Helper|View)( ?Test)?\z/, self)
|
10
10
|
register_spec_type(self) { |desc| Class === desc && desc < self }
|
11
11
|
register_rails_test_case self
|
12
12
|
before { setup_minitest_spec_rails_helper_class }
|
@@ -17,7 +17,7 @@ module MiniTestSpecRails
|
|
17
17
|
def helper_class=(new_class)
|
18
18
|
self._helper_class = new_class
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def helper_class
|
22
22
|
if current_helper_class = self._helper_class
|
23
23
|
current_helper_class
|
data/minitest-spec-rails.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
17
|
gem.require_paths = ['lib']
|
18
18
|
gem.add_runtime_dependency 'minitest', '~> 4.7'
|
19
|
-
gem.add_runtime_dependency 'rails', '
|
19
|
+
gem.add_runtime_dependency 'rails', '<= 4.0'
|
20
20
|
gem.add_development_dependency 'appraisal'
|
21
21
|
gem.add_development_dependency 'guard-minitest'
|
22
22
|
gem.add_development_dependency 'rake'
|
@@ -13,10 +13,10 @@ class ActionControllerTest < MiniTestSpecRails::TestCase
|
|
13
13
|
assert_controller MiniTest::Spec.spec_type("WidgetController")
|
14
14
|
assert_controller MiniTest::Spec.spec_type("WidgetControllerTest")
|
15
15
|
assert_controller MiniTest::Spec.spec_type("Widget Controller Test")
|
16
|
-
# And is
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
# And is case sensitive
|
17
|
+
refute_controller MiniTest::Spec.spec_type("widgetcontroller")
|
18
|
+
refute_controller MiniTest::Spec.spec_type("widgetcontrollertest")
|
19
|
+
refute_controller MiniTest::Spec.spec_type("widget controller test")
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'wont match spec type for non space characters' do
|
@@ -5,34 +5,36 @@ class ModelsController < ApplicationController; end
|
|
5
5
|
class ActionControllerTest < MiniTestSpecRails::TestCase
|
6
6
|
|
7
7
|
it 'resolves spec type for matching acceptance strings' do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
8
|
+
assert_dispatch MiniTest::Spec.spec_type("WidgetAcceptanceTest")
|
9
|
+
assert_dispatch MiniTest::Spec.spec_type("Widget Acceptance Test")
|
10
|
+
# And is case sensitive
|
11
|
+
refute_dispatch MiniTest::Spec.spec_type("widgetacceptancetest")
|
12
|
+
refute_dispatch MiniTest::Spec.spec_type("widget acceptance test")
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'wont match spec type for space characters in acceptance strings' do
|
16
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\tTest")
|
17
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\rTest")
|
18
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\nTest")
|
19
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\fTest")
|
20
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget AcceptanceXTest")
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'resolves spec type for matching integration strings' do
|
24
|
+
assert_dispatch MiniTest::Spec.spec_type("WidgetIntegrationTest")
|
25
|
+
assert_dispatch MiniTest::Spec.spec_type("Widget Integration Test")
|
26
|
+
# And is case sensitive
|
27
|
+
refute_dispatch MiniTest::Spec.spec_type("widgetintegrationtest")
|
28
|
+
refute_dispatch MiniTest::Spec.spec_type("widget integration test")
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'wont match spec type for space characters in integration strings' do
|
32
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Integration\tTest")
|
33
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Integration\rTest")
|
34
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Integration\nTest")
|
35
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Integration\fTest")
|
36
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget IntegrationXTest")
|
37
|
+
end
|
36
38
|
|
37
39
|
|
38
40
|
private
|
@@ -14,10 +14,10 @@ class ActionMailerTest < MiniTestSpecRails::TestCase
|
|
14
14
|
assert_mailer MiniTest::Spec.spec_type("WidgetMailer")
|
15
15
|
assert_mailer MiniTest::Spec.spec_type("WidgetMailerTest")
|
16
16
|
assert_mailer MiniTest::Spec.spec_type("Widget Mailer Test")
|
17
|
-
# And is
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
# And is case sensitive
|
18
|
+
refute_mailer MiniTest::Spec.spec_type("widgetmailer")
|
19
|
+
refute_mailer MiniTest::Spec.spec_type("widgetmailertest")
|
20
|
+
refute_mailer MiniTest::Spec.spec_type("widget mailer test")
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'wont match spec type for non space characters' do
|
@@ -6,20 +6,20 @@ class ActionViewTest < MiniTestSpecRails::TestCase
|
|
6
6
|
assert_view MiniTest::Spec.spec_type("WidgetHelper")
|
7
7
|
assert_view MiniTest::Spec.spec_type("WidgetHelperTest")
|
8
8
|
assert_view MiniTest::Spec.spec_type("Widget Helper Test")
|
9
|
-
# And is
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
# And is case sensitive
|
10
|
+
refute_view MiniTest::Spec.spec_type("widgethelper")
|
11
|
+
refute_view MiniTest::Spec.spec_type("widgethelpertest")
|
12
|
+
refute_view MiniTest::Spec.spec_type("widget helper test")
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'resolves spec type for matching view strings' do
|
16
16
|
assert_view MiniTest::Spec.spec_type("WidgetView")
|
17
17
|
assert_view MiniTest::Spec.spec_type("WidgetViewTest")
|
18
18
|
assert_view MiniTest::Spec.spec_type("Widget View Test")
|
19
|
-
# And is
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
# And is case sensitive
|
20
|
+
refute_view MiniTest::Spec.spec_type("widgetview")
|
21
|
+
refute_view MiniTest::Spec.spec_type("widgetviewtest")
|
22
|
+
refute_view MiniTest::Spec.spec_type("widget view test")
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'wont match spec type for non space characters' do
|
@@ -2,6 +2,13 @@ require 'test_helper_dummy'
|
|
2
2
|
|
3
3
|
class FoosHelperTest < ActionView::TestCase
|
4
4
|
|
5
|
+
it 'allows path and url helpers' do
|
6
|
+
if MiniTestSpecRails::Util.rails30? || MiniTestSpecRails::Util.rails40?
|
7
|
+
users_path_helper.must_equal '/users'
|
8
|
+
users_url_helper.must_equal 'http://test.host/users'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
5
12
|
describe 'level1' do
|
6
13
|
it 'works for helper method called in describe block' do
|
7
14
|
assert passes
|
metadata
CHANGED
@@ -2,18 +2,17 @@
|
|
2
2
|
name: minitest-spec-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 4.7.
|
5
|
+
version: 4.7.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ken Collins
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
16
|
-
type: :runtime
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
17
|
requirements:
|
19
18
|
- - ~>
|
@@ -27,25 +26,25 @@ dependencies:
|
|
27
26
|
version: '4.7'
|
28
27
|
none: false
|
29
28
|
prerelease: false
|
29
|
+
type: :runtime
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rails
|
32
|
-
type: :runtime
|
33
32
|
requirement: !ruby/object:Gem::Requirement
|
34
33
|
requirements:
|
35
|
-
- -
|
34
|
+
- - <=
|
36
35
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
36
|
+
version: '4.0'
|
38
37
|
none: false
|
39
38
|
version_requirements: !ruby/object:Gem::Requirement
|
40
39
|
requirements:
|
41
|
-
- -
|
40
|
+
- - <=
|
42
41
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
42
|
+
version: '4.0'
|
44
43
|
none: false
|
45
44
|
prerelease: false
|
45
|
+
type: :runtime
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: appraisal
|
48
|
-
type: :development
|
49
48
|
requirement: !ruby/object:Gem::Requirement
|
50
49
|
requirements:
|
51
50
|
- - ! '>='
|
@@ -59,9 +58,9 @@ dependencies:
|
|
59
58
|
version: '0'
|
60
59
|
none: false
|
61
60
|
prerelease: false
|
61
|
+
type: :development
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: guard-minitest
|
64
|
-
type: :development
|
65
64
|
requirement: !ruby/object:Gem::Requirement
|
66
65
|
requirements:
|
67
66
|
- - ! '>='
|
@@ -75,9 +74,9 @@ dependencies:
|
|
75
74
|
version: '0'
|
76
75
|
none: false
|
77
76
|
prerelease: false
|
77
|
+
type: :development
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: rake
|
80
|
-
type: :development
|
81
80
|
requirement: !ruby/object:Gem::Requirement
|
82
81
|
requirements:
|
83
82
|
- - ! '>='
|
@@ -91,9 +90,9 @@ dependencies:
|
|
91
90
|
version: '0'
|
92
91
|
none: false
|
93
92
|
prerelease: false
|
93
|
+
type: :development
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: sqlite3
|
96
|
-
type: :development
|
97
96
|
requirement: !ruby/object:Gem::Requirement
|
98
97
|
requirements:
|
99
98
|
- - ! '>='
|
@@ -107,6 +106,7 @@ dependencies:
|
|
107
106
|
version: '0'
|
108
107
|
none: false
|
109
108
|
prerelease: false
|
109
|
+
type: :development
|
110
110
|
description: The minitest-spec-rails gem makes it easy to use the MiniTest::Spec DSL
|
111
111
|
within your existing Rails 3 or 4 test suite.
|
112
112
|
email:
|
@@ -178,18 +178,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
178
178
|
requirements:
|
179
179
|
- - ! '>='
|
180
180
|
- !ruby/object:Gem::Version
|
181
|
-
segments:
|
182
|
-
- 0
|
183
|
-
hash: 3140459503075667103
|
184
181
|
version: '0'
|
185
182
|
none: false
|
186
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
184
|
requirements:
|
188
185
|
- - ! '>='
|
189
186
|
- !ruby/object:Gem::Version
|
190
|
-
segments:
|
191
|
-
- 0
|
192
|
-
hash: 3140459503075667103
|
193
187
|
version: '0'
|
194
188
|
none: false
|
195
189
|
requirements: []
|
@@ -231,3 +225,4 @@ test_files:
|
|
231
225
|
- test/support/shared_test_case_behavior.rb
|
232
226
|
- test/test_helper.rb
|
233
227
|
- test/test_helper_dummy.rb
|
228
|
+
has_rdoc:
|