minitest-spec-rails 4.7.11 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -4
- data/Appraisals +1 -14
- data/CHANGELOG.md +5 -24
- data/Gemfile +3 -1
- data/README.md +31 -12
- data/Rakefile +7 -1
- data/lib/minitest-spec-rails.rb +2 -2
- data/lib/minitest-spec-rails/dsl.rb +1 -24
- data/lib/minitest-spec-rails/init/action_controller.rb +6 -9
- data/lib/minitest-spec-rails/init/action_dispatch.rb +0 -1
- data/lib/minitest-spec-rails/init/action_mailer.rb +6 -5
- data/lib/minitest-spec-rails/init/action_view.rb +4 -16
- data/lib/minitest-spec-rails/init/active_support.rb +17 -12
- data/lib/minitest-spec-rails/railtie.rb +8 -9
- data/lib/minitest-spec-rails/version.rb +1 -1
- data/minitest-spec-rails.gemspec +2 -3
- data/test/cases/active_support_test.rb +9 -0
- data/test/dummy_tests/application_controller_test.rb +1 -6
- data/test/dummy_tests/foo_helper_test.rb +2 -4
- data/test/dummy_tests/library_test.rb +0 -1
- data/test/dummy_tests/user_mailer_test.rb +0 -5
- data/test/dummy_tests/user_test.rb +1 -4
- data/test/dummy_tests/users_helper_test.rb +0 -3
- metadata +60 -57
- checksums.yaml +0 -7
- data/lib/minitest-spec-rails/util.rb +0 -13
- data/test/dummy_tests/special_users_controller_test.rb +0 -12
data/.travis.yml
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
rvm:
|
2
|
+
- 1.9.3
|
2
3
|
- 2.0.0
|
3
|
-
- 2.1.1
|
4
4
|
install:
|
5
5
|
- gem install bundler
|
6
6
|
- bundle --version
|
7
7
|
- bundle install
|
8
8
|
before_script:
|
9
|
-
- bundle exec appraisal
|
9
|
+
- bundle exec rake appraisal:setup
|
10
10
|
script:
|
11
|
-
- bundle exec appraisal
|
12
|
-
|
11
|
+
- bundle exec rake appraisal test
|
data/Appraisals
CHANGED
@@ -1,16 +1,3 @@
|
|
1
1
|
|
2
|
-
appraise '
|
3
|
-
gem 'rails', '~> 3.0.0'
|
4
|
-
end
|
5
|
-
|
6
|
-
appraise 'rails31' do
|
7
|
-
gem 'rails', '~> 3.1.0'
|
8
|
-
end
|
9
|
-
|
10
|
-
appraise 'rails32' do
|
11
|
-
gem 'rails', '~> 3.2.0'
|
12
|
-
end
|
13
|
-
|
14
|
-
appraise 'rails40' do
|
15
|
-
gem 'rails', '~> 4.0.0'
|
2
|
+
appraise 'rails41' do
|
16
3
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,28 +1,9 @@
|
|
1
|
-
## 4.7.10
|
2
1
|
|
3
|
-
|
2
|
+
## 5.0.0
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
*
|
8
|
-
|
9
|
-
## 4.7.8
|
10
|
-
|
11
|
-
* Change initialization so that ActiveSupport always comes first. Fixes #63.
|
12
|
-
|
13
|
-
## 4.7.7
|
14
|
-
|
15
|
-
* Fixed LoadError::REGEXPS addition by requiring file first.
|
16
|
-
|
17
|
-
|
18
|
-
## 4.7.6
|
19
|
-
|
20
|
-
* Fix nested described test names. Fixes #21.
|
21
|
-
|
22
|
-
|
23
|
-
## 4.7.5
|
24
|
-
|
25
|
-
* Fixed gemspec using '>= 3.0', '< 4.1'. Fixed #35.
|
4
|
+
* Minitest 5.x and Rails 4.x compatability. Fixes #36.
|
5
|
+
* Fix nested described test names along with Minitest::Spec.describe_stack. Fixed #21.
|
6
|
+
* Leverage `ActiveSupport::Testing::ConstantLookup` for our `described_class` interface.
|
26
7
|
|
27
8
|
|
28
9
|
## 4.7.4
|
@@ -133,4 +114,4 @@
|
|
133
114
|
|
134
115
|
## v3.0.0
|
135
116
|
|
136
|
-
* Initial Release, targeted to Rails 3.x.
|
117
|
+
* Initial Release, targeted to Rails 3.x.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
<img src="http://cdn.metaskills.net/minitest-spec-rails.png" width="233" height="154" />
|
3
2
|
|
4
3
|
# Make Rails Use MiniTest::Spec!
|
@@ -13,10 +12,17 @@ The minitest-spec-rails gem makes it easy to use the MiniTest::Spec DSL within y
|
|
13
12
|
|
14
13
|
## Usage
|
15
14
|
|
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
|
15
|
+
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 MiniTest::Spec is built on top of MiniTest::Unit, a replacement for Test::Unit, all of your existing tests will continue to work.
|
16
|
+
|
17
|
+
|
18
|
+
#### Rails 4.1
|
19
|
+
|
20
|
+
Our master branch is tracking rails master which is active development for Rails 4.1 which uses minitest 5.0.
|
17
21
|
|
18
22
|
|
19
|
-
#### For Rails 3.x
|
23
|
+
#### For Rails 3.x or 4.0
|
24
|
+
|
25
|
+
Our [3-x-stable](https://github.com/metaskills/minitest-spec-rails/tree/3-x-stable) branch is meant for both Rails 3.x or 4.0 specifically. This version uses the latest 4.x series of minitest.
|
20
26
|
|
21
27
|
```ruby
|
22
28
|
group :test do
|
@@ -24,6 +30,16 @@ group :test do
|
|
24
30
|
end
|
25
31
|
```
|
26
32
|
|
33
|
+
#### For Rails 2.3
|
34
|
+
|
35
|
+
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!
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
group :test do
|
39
|
+
gem 'minitest-spec-rails', '~> 3.1'
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
27
43
|
#### Ruby 1.8 Users!!!
|
28
44
|
|
29
45
|
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.
|
@@ -55,7 +71,7 @@ gem 'minitest-spec-rails'
|
|
55
71
|
|
56
72
|
## Test Styles
|
57
73
|
|
58
|
-
This <a href="http://cheat.errtheblog.com/s/minitest">cheat sheet</a> shows both the MiniTest::Unit assertions along with the MiniTest::Spec assertion syntax. Remember, MiniTest::Spec is
|
74
|
+
This <a href="http://cheat.errtheblog.com/s/minitest">cheat sheet</a> shows both the MiniTest::Unit assertions along with the MiniTest::Spec assertion syntax. Remember, MiniTest::Spec is built on top of MiniTest::Unit which is a Test::Unit replacement. That means you can mix and match styles as you upgrade from Test::Unit to a more modern style. For example, both of these would work in MiniTest::Spec and are interchangeable.
|
59
75
|
|
60
76
|
```ruby
|
61
77
|
# MiniTest::Unit Assertion Style:
|
@@ -65,7 +81,6 @@ assert_equal 100, foo
|
|
65
81
|
foo.must_equal 100
|
66
82
|
```
|
67
83
|
|
68
|
-
All existing Rails test cases that subclass ActiveSupport::TestCase will continue to work and I personally suggest that you still **use the subclass convention** vs the outer describe test case convention. However either will work.
|
69
84
|
|
70
85
|
```ruby
|
71
86
|
require 'test_helper'
|
@@ -84,10 +99,10 @@ describe User do
|
|
84
99
|
end
|
85
100
|
```
|
86
101
|
|
87
|
-
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.
|
102
|
+
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.
|
88
103
|
|
89
104
|
```ruby
|
90
|
-
# Model Test
|
105
|
+
# Model Test
|
91
106
|
class UserTest < ActiveSupport::TestCase
|
92
107
|
end
|
93
108
|
describe User do
|
@@ -122,7 +137,7 @@ end
|
|
122
137
|
We have baked in a few extra methods behind the scenes to minitest-spec-rails. Most directly support our needs to reflect on described classes, however, they may be useful to you too when meta-programming on top of minitest-spec-rails.
|
123
138
|
|
124
139
|
### #described_class
|
125
|
-
The `described_class` method is available both via a class method and an instance method in any Rails test case. It is guaranteed to work despite the described level too. This allows class level macros to be
|
140
|
+
The `described_class` method is available both via a class method and an instance method in any Rails test case. It is guaranteed to work despite the described level too. This allows class level macros to be built, much like Shoulda. Remember, it can only do this if you follow Rails naming conventions for your tests.
|
126
141
|
|
127
142
|
```ruby
|
128
143
|
class UserTest < ActiveSupport::TestCase
|
@@ -243,6 +258,10 @@ class UserMailerTest < ActionMailer::TestCase
|
|
243
258
|
end
|
244
259
|
```
|
245
260
|
|
261
|
+
### Rails 3.1 & 3.2
|
262
|
+
|
263
|
+
If your view helper tests give you an eror like this: `RuntimeError: In order to use #url_for, you must include routing helpers explicitly.`, this is something that is broken only for Rails 3.1 and 3.2, both 3.0 and 4.0 and above do not exhibit this error. I have heard that if you `include Rails.application.routes.url_helpers` in your tests or inject them into the helper module before the test it may work. Lemme know what you find out.
|
264
|
+
|
246
265
|
|
247
266
|
## Contributing
|
248
267
|
|
@@ -250,14 +269,14 @@ We run our tests on [Travis CI](http://travis-ci.org/metaskills/minitest-spec-ra
|
|
250
269
|
|
251
270
|
```shell
|
252
271
|
$ bundle install
|
253
|
-
$ bundle exec appraisal
|
254
|
-
$ bundle exec appraisal
|
272
|
+
$ bundle exec rake appraisal:setup
|
273
|
+
$ bundle exec rake appraisal test
|
255
274
|
```
|
256
275
|
|
257
|
-
We use the [appraisal](https://github.com/thoughtbot/appraisal) gem from Thoughtbot to help us generate the individual gemfiles for each Rails version and to run the tests locally against each generated Gemfile. The `rake appraisal test` command actually runs our test suite against all Rails versions in our `Appraisal` file. If you want to run the tests for a specific Rails version, use `
|
276
|
+
We use the [appraisal](https://github.com/thoughtbot/appraisal) gem from Thoughtbot to help us generate the individual gemfiles for each Rails version and to run the tests locally against each generated Gemfile. The `rake appraisal test` command actually runs our test suite against all Rails versions in our `Appraisal` file. If you want to run the tests for a specific Rails version, use `rake -T` for a list. For example, the following command will run the tests for Rails 4.1 only.
|
258
277
|
|
259
278
|
```shell
|
260
|
-
$ bundle exec appraisal
|
279
|
+
$ bundle exec rake appraisal:rails41 test
|
261
280
|
```
|
262
281
|
|
263
282
|
We have a few branches for each major Rails version.
|
data/Rakefile
CHANGED
@@ -1,13 +1,19 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'bundler/gem_tasks'
|
3
3
|
require 'rake/testtask'
|
4
|
+
require 'appraisal'
|
4
5
|
|
5
6
|
Rake::TestTask.new do |t|
|
6
7
|
t.libs = ['lib','test']
|
7
8
|
t.test_files = Dir.glob("test/**/*_test.rb").sort
|
8
9
|
t.verbose = true
|
9
|
-
t.warning = false
|
10
10
|
end
|
11
11
|
|
12
12
|
task :default => :test
|
13
13
|
|
14
|
+
desc "Setup Appraisal."
|
15
|
+
task 'appraisal:setup' do
|
16
|
+
Rake::Task['appraisal:cleanup'].invoke
|
17
|
+
Rake::Task['appraisal:gemfiles'].invoke
|
18
|
+
Rake::Task['appraisal:install'].invoke
|
19
|
+
end
|
data/lib/minitest-spec-rails.rb
CHANGED
@@ -2,9 +2,9 @@ module MiniTestSpecRails
|
|
2
2
|
end
|
3
3
|
|
4
4
|
require 'rails'
|
5
|
+
gem 'minitest'
|
6
|
+
require 'minitest'
|
5
7
|
require 'minitest/spec'
|
6
|
-
require 'minitest-spec-rails/util'
|
7
8
|
require 'minitest-spec-rails/version'
|
8
9
|
require 'minitest-spec-rails/dsl'
|
9
10
|
require 'minitest-spec-rails/railtie'
|
10
|
-
require 'minitest-spec-rails/init/active_support'
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module MiniTestSpecRails
|
2
2
|
module DSL
|
3
3
|
|
4
|
-
RAILS_TEST_CASES = []
|
5
|
-
|
6
4
|
def self.included(klass)
|
7
5
|
klass.extend ClassMethods
|
8
6
|
remove_method :test if method_defined?(:test)
|
@@ -29,33 +27,12 @@ module MiniTestSpecRails
|
|
29
27
|
it { self.instance_eval(&block) }
|
30
28
|
end
|
31
29
|
|
32
|
-
def rails_test_cases
|
33
|
-
RAILS_TEST_CASES
|
34
|
-
end
|
35
|
-
|
36
|
-
def register_rails_test_case(test_case)
|
37
|
-
return if RAILS_TEST_CASES.include?(test_case)
|
38
|
-
RAILS_TEST_CASES.unshift(test_case)
|
39
|
-
end
|
40
|
-
|
41
|
-
def describing_class
|
42
|
-
ancestors.detect { |a| Class === a && rails_test_cases.include?(a.superclass) }
|
43
|
-
end
|
44
|
-
|
45
30
|
def described_class
|
46
|
-
|
47
|
-
describing_class.name.gsub(/Test$/, '').constantize
|
48
|
-
rescue NameError
|
49
|
-
nil
|
50
|
-
end
|
31
|
+
nil
|
51
32
|
end
|
52
33
|
|
53
34
|
end
|
54
35
|
|
55
|
-
def describing_class
|
56
|
-
self.class.describing_class
|
57
|
-
end
|
58
|
-
|
59
36
|
def described_class
|
60
37
|
self.class.described_class
|
61
38
|
end
|
@@ -5,21 +5,18 @@ module MiniTestSpecRails
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
7
|
included do
|
8
|
+
extend Descriptions
|
8
9
|
register_spec_type(self) { |desc| Class === desc && desc < ActionController::Metal }
|
9
10
|
register_spec_type(/Controller( ?Test)?\z/, self)
|
10
11
|
register_spec_type(self) { |desc| Class === desc && desc < self }
|
11
|
-
register_rails_test_case self
|
12
12
|
end
|
13
|
+
|
14
|
+
module Descriptions
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
def setup_controller_request_and_response
|
17
|
-
if Util.rails30? || Util.rails31?
|
18
|
-
self.class.tests described_class if described_class
|
19
|
-
else
|
20
|
-
describing_class.tests described_class if described_class
|
16
|
+
def described_class
|
17
|
+
determine_default_controller_class(name)
|
21
18
|
end
|
22
|
-
|
19
|
+
|
23
20
|
end
|
24
21
|
|
25
22
|
end
|
@@ -8,14 +8,15 @@ module MiniTestSpecRails
|
|
8
8
|
register_spec_type(self) { |desc| Class === desc && desc < ActionMailer::Base }
|
9
9
|
register_spec_type(/Mailer( ?Test)?\z/, self)
|
10
10
|
register_spec_type(self) { |desc| Class === desc && desc < self }
|
11
|
-
|
12
|
-
before { setup_minitest_spec_rails_mailer_class }
|
11
|
+
extend Descriptions
|
13
12
|
end
|
14
13
|
|
15
|
-
|
14
|
+
module Descriptions
|
15
|
+
|
16
|
+
def described_class
|
17
|
+
determine_default_mailer(name)
|
18
|
+
end
|
16
19
|
|
17
|
-
def setup_minitest_spec_rails_mailer_class
|
18
|
-
describing_class.tests described_class
|
19
20
|
end
|
20
21
|
|
21
22
|
end
|
@@ -8,27 +8,15 @@ module MiniTestSpecRails
|
|
8
8
|
class_attribute :_helper_class
|
9
9
|
register_spec_type(/(Helper|View)( ?Test)?\z/, self)
|
10
10
|
register_spec_type(self) { |desc| Class === desc && desc < self }
|
11
|
-
|
12
|
-
before { setup_minitest_spec_rails_helper_class }
|
11
|
+
extend Descriptions
|
13
12
|
end
|
14
13
|
|
15
|
-
|
14
|
+
module Descriptions
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
def helper_class
|
22
|
-
if current_helper_class = self._helper_class
|
23
|
-
current_helper_class
|
24
|
-
else
|
25
|
-
self.helper_class = determine_default_helper_class(name)
|
16
|
+
def described_class
|
17
|
+
determine_default_helper_class(name)
|
26
18
|
end
|
27
|
-
end
|
28
19
|
|
29
|
-
def setup_minitest_spec_rails_helper_class
|
30
|
-
self.class.helper_class = described_class
|
31
|
-
self.class.send :include_helper_modules!
|
32
20
|
end
|
33
21
|
|
34
22
|
end
|
@@ -8,8 +8,24 @@ module MiniTestSpecRails
|
|
8
8
|
singleton_class.class_eval { remove_method :describe }
|
9
9
|
extend MiniTest::Spec::DSL
|
10
10
|
include MiniTestSpecRails::DSL
|
11
|
+
include ActiveSupport::Testing::ConstantLookup
|
12
|
+
extend Descriptions
|
11
13
|
register_spec_type(self) { |desc| Class === desc }
|
12
|
-
|
14
|
+
end
|
15
|
+
|
16
|
+
module Descriptions
|
17
|
+
|
18
|
+
def described_class
|
19
|
+
determine_constant_from_test_name(name) do |constant|
|
20
|
+
Class === constant
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
def initialize(*args)
|
27
|
+
Thread.current[:current_spec] = self
|
28
|
+
super
|
13
29
|
end
|
14
30
|
|
15
31
|
end
|
@@ -17,14 +33,3 @@ module MiniTestSpecRails
|
|
17
33
|
end
|
18
34
|
|
19
35
|
ActiveSupport::TestCase.send :include, MiniTestSpecRails::Init::ActiveSupportBehavior
|
20
|
-
|
21
|
-
|
22
|
-
# The AbstractController::Helpers#default_helper_module! blows up using
|
23
|
-
# ActiveSupport's modified LoadError class under Ruby 1.8 because describe
|
24
|
-
# blocks with spaces for their names have a `module_path` of something like
|
25
|
-
# "nested 1" while in Ruby 1.9 it is something like "#<Class:0x007fa256ea1118>"
|
26
|
-
# and hence wont find a #path match in REGEXPS due to the space. So add
|
27
|
-
# another that allows filenames with spaces in it.
|
28
|
-
#
|
29
|
-
require 'active_support/core_ext/load_error'
|
30
|
-
LoadError::REGEXPS << %r{^Missing \w+ (?:file\s*)?(.*\.rb)$}i
|
@@ -1,14 +1,16 @@
|
|
1
1
|
module MiniTestSpecRails
|
2
2
|
class Railtie < ::Rails::Railtie
|
3
|
-
|
3
|
+
|
4
4
|
config.minitest_spec_rails = ActiveSupport::OrderedOptions.new
|
5
5
|
config.minitest_spec_rails.mini_shoulda = false
|
6
|
-
|
6
|
+
|
7
7
|
config.before_initialize do |app|
|
8
8
|
if Rails.env.test?
|
9
|
-
ActiveSupport.on_load(:
|
9
|
+
ActiveSupport.on_load(:action_view) do
|
10
|
+
require 'minitest-spec-rails/init/action_view'
|
11
|
+
end
|
12
|
+
ActiveSupport.on_load(:action_controller) do
|
10
13
|
require 'minitest-spec-rails/init/action_controller'
|
11
|
-
require 'action_dispatch/testing/integration' # For Rails 3.0 loading.
|
12
14
|
require 'minitest-spec-rails/init/action_dispatch'
|
13
15
|
end
|
14
16
|
ActiveSupport.on_load(:action_mailer) do
|
@@ -17,15 +19,12 @@ module MiniTestSpecRails
|
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
|
-
initializer 'minitest-spec-rails.action_view', :after => 'action_view.setup_action_pack', :group => :all do |app|
|
21
|
-
require 'minitest-spec-rails/init/action_view'
|
22
|
-
end if Rails.env.test?
|
23
|
-
|
24
22
|
initializer 'minitest-spec-rails.after.load_active_support', :after => :load_active_support, :group => :all do |app|
|
25
23
|
if Rails.env.test?
|
24
|
+
require 'minitest-spec-rails/init/active_support'
|
26
25
|
require 'minitest-spec-rails/init/mini_shoulda' if app.config.minitest_spec_rails.mini_shoulda
|
27
26
|
end
|
28
27
|
end
|
29
|
-
|
28
|
+
|
30
29
|
end
|
31
30
|
end
|
data/minitest-spec-rails.gemspec
CHANGED
@@ -16,10 +16,9 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
17
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
gem.require_paths = ['lib']
|
19
|
-
gem.add_runtime_dependency 'minitest', '~>
|
20
|
-
gem.add_runtime_dependency 'rails', '>=
|
19
|
+
gem.add_runtime_dependency 'minitest', '~> 5.0'
|
20
|
+
gem.add_runtime_dependency 'rails', '>= 4.1.0.beta', '< 5.0'
|
21
21
|
gem.add_development_dependency 'appraisal'
|
22
|
-
gem.add_development_dependency 'bundler'
|
23
22
|
gem.add_development_dependency 'guard-minitest'
|
24
23
|
gem.add_development_dependency 'rake'
|
25
24
|
gem.add_development_dependency 'sqlite3'
|
@@ -42,6 +42,14 @@ class ActiveSupportCallbackTest < ActiveSupport::TestCase
|
|
42
42
|
|
43
43
|
end
|
44
44
|
|
45
|
+
class ActiveSupportSpecTest < ActiveSupport::TestCase
|
46
|
+
|
47
|
+
it 'current spec name' do
|
48
|
+
Thread.current[:current_spec].must_equal self
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
45
53
|
class ActiveSupportDescribeNamesTest < ActiveSupport::TestCase
|
46
54
|
it 'class name' do
|
47
55
|
assert_equal 'ActiveSupportDescribeNamesTest', self.class.name
|
@@ -57,3 +65,4 @@ class ActiveSupportDescribeNamesTest < ActiveSupport::TestCase
|
|
57
65
|
end
|
58
66
|
end
|
59
67
|
end
|
68
|
+
|
@@ -4,8 +4,6 @@ module ApplicationControllerTests
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
included do
|
6
6
|
|
7
|
-
tests ApplicationController if MiniTestSpecRails::Util.rails30?
|
8
|
-
|
9
7
|
before { get :index }
|
10
8
|
|
11
9
|
it 'works' do
|
@@ -46,20 +44,17 @@ end
|
|
46
44
|
|
47
45
|
class ApplicationControllerTest < ActionController::TestCase
|
48
46
|
include ApplicationControllerTests
|
49
|
-
|
50
|
-
describing_class.must_equal ApplicationControllerTest
|
47
|
+
it 'reflects' do
|
51
48
|
described_class.must_equal ApplicationController
|
52
49
|
self.class.described_class.must_equal ApplicationController
|
53
50
|
end
|
54
51
|
describe 'level 1' do
|
55
52
|
it 'reflects' do
|
56
|
-
describing_class.must_equal ApplicationControllerTest
|
57
53
|
described_class.must_equal ApplicationController
|
58
54
|
self.class.described_class.must_equal ApplicationController
|
59
55
|
end
|
60
56
|
describe 'level 2' do
|
61
57
|
it 'reflects' do
|
62
|
-
describing_class.must_equal ApplicationControllerTest
|
63
58
|
described_class.must_equal ApplicationController
|
64
59
|
self.class.described_class.must_equal ApplicationController
|
65
60
|
end
|
@@ -3,10 +3,8 @@ require 'test_helper_dummy'
|
|
3
3
|
class FoosHelperTest < ActionView::TestCase
|
4
4
|
|
5
5
|
it 'allows path and url helpers' do
|
6
|
-
|
7
|
-
|
8
|
-
users_url_helper.must_equal 'http://test.host/users'
|
9
|
-
end
|
6
|
+
users_path_helper.must_equal '/users'
|
7
|
+
users_url_helper.must_equal 'http://test.host/users'
|
10
8
|
end
|
11
9
|
|
12
10
|
describe 'level1' do
|
@@ -4,8 +4,6 @@ module UserMailerTests
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
included do
|
6
6
|
|
7
|
-
tests UserMailer if MiniTestSpecRails::Util.rails30?
|
8
|
-
|
9
7
|
let(:deliveries) { ActionMailer::Base.deliveries }
|
10
8
|
let(:user_mailer_class) { UserMailer }
|
11
9
|
let(:user_email) { user_mailer_class.welcome(user_ken).deliver }
|
@@ -49,19 +47,16 @@ end
|
|
49
47
|
class UserMailerTest < ActionMailer::TestCase
|
50
48
|
include UserMailerTests
|
51
49
|
it 'reflects' do
|
52
|
-
describing_class.must_equal UserMailerTest
|
53
50
|
described_class.must_equal UserMailer
|
54
51
|
self.class.described_class.must_equal UserMailer
|
55
52
|
end
|
56
53
|
describe 'level 1' do
|
57
54
|
it 'reflects' do
|
58
|
-
describing_class.must_equal UserMailerTest
|
59
55
|
described_class.must_equal UserMailer
|
60
56
|
self.class.described_class.must_equal UserMailer
|
61
57
|
end
|
62
58
|
describe 'level 2' do
|
63
59
|
it 'reflects' do
|
64
|
-
describing_class.must_equal UserMailerTest
|
65
60
|
described_class.must_equal UserMailer
|
66
61
|
self.class.described_class.must_equal UserMailer
|
67
62
|
end
|
@@ -13,7 +13,7 @@ module UserTests
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'allows custom assertions' do
|
16
|
-
|
16
|
+
assert_not false
|
17
17
|
end
|
18
18
|
|
19
19
|
describe 'nested 1' do
|
@@ -38,19 +38,16 @@ end
|
|
38
38
|
class UserTest < ActiveSupport::TestCase
|
39
39
|
include UserTests
|
40
40
|
it 'reflects' do
|
41
|
-
describing_class.must_equal UserTest
|
42
41
|
described_class.must_equal User
|
43
42
|
self.class.described_class.must_equal User
|
44
43
|
end
|
45
44
|
describe 'level 1' do
|
46
45
|
it 'reflects' do
|
47
|
-
describing_class.must_equal UserTest
|
48
46
|
described_class.must_equal User
|
49
47
|
self.class.described_class.must_equal User
|
50
48
|
end
|
51
49
|
describe 'level 2' do
|
52
50
|
it 'reflects' do
|
53
|
-
describing_class.must_equal UserTest
|
54
51
|
described_class.must_equal User
|
55
52
|
self.class.described_class.must_equal User
|
56
53
|
end
|
@@ -39,19 +39,16 @@ end
|
|
39
39
|
class UsersHelperTest < ActionView::TestCase
|
40
40
|
include UsersHelperTests
|
41
41
|
it 'reflects' do
|
42
|
-
describing_class.must_equal UsersHelperTest
|
43
42
|
described_class.must_equal UsersHelper
|
44
43
|
self.class.described_class.must_equal UsersHelper
|
45
44
|
end
|
46
45
|
describe 'level 1' do
|
47
46
|
it 'reflects' do
|
48
|
-
describing_class.must_equal UsersHelperTest
|
49
47
|
described_class.must_equal UsersHelper
|
50
48
|
self.class.described_class.must_equal UsersHelper
|
51
49
|
end
|
52
50
|
describe 'level 2' do
|
53
51
|
it 'reflects' do
|
54
|
-
describing_class.must_equal UsersHelperTest
|
55
52
|
described_class.must_equal UsersHelper
|
56
53
|
self.class.described_class.must_equal UsersHelper
|
57
54
|
end
|
metadata
CHANGED
@@ -1,119 +1,118 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-spec-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 5.0.0
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Ken Collins
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2013-11-27 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: minitest
|
16
|
+
type: :runtime
|
15
17
|
requirement: !ruby/object:Gem::Requirement
|
16
18
|
requirements:
|
17
|
-
- -
|
19
|
+
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
|
21
|
-
prerelease: false
|
21
|
+
version: '5.0'
|
22
|
+
none: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
|
-
- -
|
25
|
+
- - ~>
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
27
|
+
version: '5.0'
|
28
|
+
none: false
|
29
|
+
prerelease: false
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: rails
|
32
|
+
type: :runtime
|
29
33
|
requirement: !ruby/object:Gem::Requirement
|
30
34
|
requirements:
|
31
|
-
- -
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
- -
|
37
|
+
version: 4.1.0.beta
|
38
|
+
- - <
|
35
39
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
37
|
-
|
38
|
-
prerelease: false
|
40
|
+
version: '5.0'
|
41
|
+
none: false
|
39
42
|
version_requirements: !ruby/object:Gem::Requirement
|
40
43
|
requirements:
|
41
|
-
- -
|
44
|
+
- - ! '>='
|
42
45
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
44
|
-
- -
|
46
|
+
version: 4.1.0.beta
|
47
|
+
- - <
|
45
48
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
49
|
+
version: '5.0'
|
50
|
+
none: false
|
51
|
+
prerelease: false
|
47
52
|
- !ruby/object:Gem::Dependency
|
48
53
|
name: appraisal
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
54
|
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '0'
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: bundler
|
63
55
|
requirement: !ruby/object:Gem::Requirement
|
64
56
|
requirements:
|
65
|
-
- -
|
57
|
+
- - ! '>='
|
66
58
|
- !ruby/object:Gem::Version
|
67
59
|
version: '0'
|
68
|
-
|
69
|
-
prerelease: false
|
60
|
+
none: false
|
70
61
|
version_requirements: !ruby/object:Gem::Requirement
|
71
62
|
requirements:
|
72
|
-
- -
|
63
|
+
- - ! '>='
|
73
64
|
- !ruby/object:Gem::Version
|
74
65
|
version: '0'
|
66
|
+
none: false
|
67
|
+
prerelease: false
|
75
68
|
- !ruby/object:Gem::Dependency
|
76
69
|
name: guard-minitest
|
70
|
+
type: :development
|
77
71
|
requirement: !ruby/object:Gem::Requirement
|
78
72
|
requirements:
|
79
|
-
- -
|
73
|
+
- - ! '>='
|
80
74
|
- !ruby/object:Gem::Version
|
81
75
|
version: '0'
|
82
|
-
|
83
|
-
prerelease: false
|
76
|
+
none: false
|
84
77
|
version_requirements: !ruby/object:Gem::Requirement
|
85
78
|
requirements:
|
86
|
-
- -
|
79
|
+
- - ! '>='
|
87
80
|
- !ruby/object:Gem::Version
|
88
81
|
version: '0'
|
82
|
+
none: false
|
83
|
+
prerelease: false
|
89
84
|
- !ruby/object:Gem::Dependency
|
90
85
|
name: rake
|
86
|
+
type: :development
|
91
87
|
requirement: !ruby/object:Gem::Requirement
|
92
88
|
requirements:
|
93
|
-
- -
|
89
|
+
- - ! '>='
|
94
90
|
- !ruby/object:Gem::Version
|
95
91
|
version: '0'
|
96
|
-
|
97
|
-
prerelease: false
|
92
|
+
none: false
|
98
93
|
version_requirements: !ruby/object:Gem::Requirement
|
99
94
|
requirements:
|
100
|
-
- -
|
95
|
+
- - ! '>='
|
101
96
|
- !ruby/object:Gem::Version
|
102
97
|
version: '0'
|
98
|
+
none: false
|
99
|
+
prerelease: false
|
103
100
|
- !ruby/object:Gem::Dependency
|
104
101
|
name: sqlite3
|
102
|
+
type: :development
|
105
103
|
requirement: !ruby/object:Gem::Requirement
|
106
104
|
requirements:
|
107
|
-
- -
|
105
|
+
- - ! '>='
|
108
106
|
- !ruby/object:Gem::Version
|
109
107
|
version: '0'
|
110
|
-
|
111
|
-
prerelease: false
|
108
|
+
none: false
|
112
109
|
version_requirements: !ruby/object:Gem::Requirement
|
113
110
|
requirements:
|
114
|
-
- -
|
111
|
+
- - ! '>='
|
115
112
|
- !ruby/object:Gem::Version
|
116
113
|
version: '0'
|
114
|
+
none: false
|
115
|
+
prerelease: false
|
117
116
|
description: The minitest-spec-rails gem makes it easy to use the MiniTest::Spec DSL
|
118
117
|
within your existing Rails 3 or 4 test suite.
|
119
118
|
email:
|
@@ -122,8 +121,8 @@ executables: []
|
|
122
121
|
extensions: []
|
123
122
|
extra_rdoc_files: []
|
124
123
|
files:
|
125
|
-
-
|
126
|
-
-
|
124
|
+
- .gitignore
|
125
|
+
- .travis.yml
|
127
126
|
- Appraisals
|
128
127
|
- CHANGELOG.md
|
129
128
|
- Gemfile
|
@@ -140,7 +139,6 @@ files:
|
|
140
139
|
- lib/minitest-spec-rails/init/active_support.rb
|
141
140
|
- lib/minitest-spec-rails/init/mini_shoulda.rb
|
142
141
|
- lib/minitest-spec-rails/railtie.rb
|
143
|
-
- lib/minitest-spec-rails/util.rb
|
144
142
|
- lib/minitest-spec-rails/version.rb
|
145
143
|
- minitest-spec-rails.gemspec
|
146
144
|
- test/cases/action_controller_test.rb
|
@@ -167,7 +165,6 @@ files:
|
|
167
165
|
- test/dummy_tests/foo_helper_test.rb
|
168
166
|
- test/dummy_tests/integration_test.rb
|
169
167
|
- test/dummy_tests/library_test.rb
|
170
|
-
- test/dummy_tests/special_users_controller_test.rb
|
171
168
|
- test/dummy_tests/user_mailer_test.rb
|
172
169
|
- test/dummy_tests/user_test.rb
|
173
170
|
- test/dummy_tests/users_controller_test.rb
|
@@ -179,26 +176,33 @@ files:
|
|
179
176
|
homepage: http://github.com/metaskills/minitest-spec-rails
|
180
177
|
licenses:
|
181
178
|
- MIT
|
182
|
-
metadata: {}
|
183
179
|
post_install_message:
|
184
180
|
rdoc_options: []
|
185
181
|
require_paths:
|
186
182
|
- lib
|
187
183
|
required_ruby_version: !ruby/object:Gem::Requirement
|
188
184
|
requirements:
|
189
|
-
- -
|
185
|
+
- - ! '>='
|
190
186
|
- !ruby/object:Gem::Version
|
187
|
+
segments:
|
188
|
+
- 0
|
189
|
+
hash: 1614700249652429309
|
191
190
|
version: '0'
|
191
|
+
none: false
|
192
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
193
|
requirements:
|
194
|
-
- -
|
194
|
+
- - ! '>='
|
195
195
|
- !ruby/object:Gem::Version
|
196
|
+
segments:
|
197
|
+
- 0
|
198
|
+
hash: 1614700249652429309
|
196
199
|
version: '0'
|
200
|
+
none: false
|
197
201
|
requirements: []
|
198
202
|
rubyforge_project:
|
199
|
-
rubygems_version:
|
203
|
+
rubygems_version: 1.8.25
|
200
204
|
signing_key:
|
201
|
-
specification_version:
|
205
|
+
specification_version: 3
|
202
206
|
summary: Make Rails Use MiniTest::Spec!
|
203
207
|
test_files:
|
204
208
|
- test/cases/action_controller_test.rb
|
@@ -225,7 +229,6 @@ test_files:
|
|
225
229
|
- test/dummy_tests/foo_helper_test.rb
|
226
230
|
- test/dummy_tests/integration_test.rb
|
227
231
|
- test/dummy_tests/library_test.rb
|
228
|
-
- test/dummy_tests/special_users_controller_test.rb
|
229
232
|
- test/dummy_tests/user_mailer_test.rb
|
230
233
|
- test/dummy_tests/user_test.rb
|
231
234
|
- test/dummy_tests/users_controller_test.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: cf33c40d0a0f3d84a04175b4495ae9ca15f72046
|
4
|
-
data.tar.gz: 534cbfa9c59da1b3687c98a891ef6ac759c26379
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 5041e862179b9875ca466acf56e2c6de9cb1a3c87741fc4d5313d47bd0b9f3a3a0c80556d73145962d97108264c93010d1469a12c095cf2cf4b75f2aaffd4d3b
|
7
|
-
data.tar.gz: f989821038d7e6781f30c7d6438cf9f5f65158f862ea28838e743eedc6cd76ce9c5880c5c4b87e22cbaee69acffd0fa9eb35da17085666f8b4aaf02542fdefee
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module MiniTestSpecRails
|
2
|
-
module Util
|
3
|
-
|
4
|
-
def self.rails3? ; rails30? || rails31? || rails32? ; end
|
5
|
-
def self.rails30? ; rails_version == '3.0' ; end
|
6
|
-
def self.rails31? ; rails_version == '3.1' ; end
|
7
|
-
def self.rails32? ; rails_version == '3.2' ; end
|
8
|
-
def self.rails40? ; rails_version == '4.0' ; end
|
9
|
-
|
10
|
-
def self.rails_version ; ::Rails.version.split('.')[0,2].join('.') ; end
|
11
|
-
|
12
|
-
end
|
13
|
-
end
|