rr 1.1.0.rc2 → 1.1.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +24 -9
- data/README.md +36 -9
- data/VERSION +1 -1
- data/lib/rr/adapters.rb +2 -5
- data/lib/rr/autohook.rb +5 -3
- data/lib/rr/integrations/minitest.rb +13 -31
- data/lib/rr/integrations/minitest_4.rb +66 -0
- data/lib/rr/integrations/minitest_4_active_support.rb +39 -0
- data/lib/rr/integrations/minitest_active_support.rb +4 -25
- data/lib/rr/without_autohook.rb +7 -0
- data/spec/suite.rb +19 -21
- data/spec/suites/common/adapter_integration_tests.rb +14 -5
- data/spec/suites/common/test_unit_tests.rb +0 -4
- data/spec/suites/minitest/integration/minitest_test.rb +5 -5
- data/spec/suites/rspec_2/integration/minitest_4_rails_spec.rb +72 -0
- data/spec/suites/rspec_2/integration/minitest_4_spec.rb +67 -0
- data/spec/suites/rspec_2/integration/minitest_rails_spec.rb +3 -3
- data/spec/suites/rspec_2/integration/minitest_spec.rb +7 -7
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f7ead27c1ade6086d4ecf049c31d7bb3b3a0e6a
|
4
|
+
data.tar.gz: 263773f5163f8d3101a83ec0bf94903d42c5414d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d4c5ac4cd5286852fc7b981b0eeb1f259a8eca3b05445e1b5ff846c3d5c702b0f5065d6af304a1e1f8b178d459f4e1bb83fd7f96f74eea1e4a75b980a083a09
|
7
|
+
data.tar.gz: b6a666dc686d23f427df86e1c4c9e83749eef0ab6e7faa5b5ad2d76e8c0fcdd243d341230d085bfc3c9664f4217f5853ae337c03e1d2fc0c881daa86fa2f4d7a
|
data/CHANGES.md
CHANGED
@@ -3,26 +3,27 @@
|
|
3
3
|
## 1.1.0 (UNRELEASED)
|
4
4
|
|
5
5
|
* Fix a line in RR::Injections::DoubleInjection to use top-level RR constant
|
6
|
-
[Thibaut]
|
6
|
+
([#3][i3]) [[@Thibaut][Thibaut]]
|
7
7
|
* Fix all wildcard matches so they work within hashes and arrays. This means
|
8
8
|
that `stub([hash_containing(:foo => 'bar')])` will match
|
9
|
-
`stub([{:foo => 'bar', :baz => 'qux'}])`.
|
9
|
+
`stub([{:foo => 'bar', :baz => 'qux'}])`. ([#4][i4])
|
10
10
|
* RR now auto-hooks into whichever test framework you have loaded; there is no
|
11
11
|
longer a need to `include RR::Adapters::Whatever` into your test framework. If
|
12
12
|
you don't like the autohook and prefer the old way, simply use
|
13
13
|
`require 'rr/without_autohook'` instead of `require 'rr'`. (There are now
|
14
|
-
|
14
|
+
nine adapters; see [lib/rr/autohook.rb][autohook] for the full list.)
|
15
15
|
* Fix Test::Unit adapters to ensure that any additional teardown is completely
|
16
16
|
run in the event that RR's verify step produces an error. This was causing
|
17
|
-
weirdness when using Test::Unit alongside Rails.
|
17
|
+
weirdness when using Test::Unit alongside Rails. ([#2][i2])
|
18
18
|
* Add an explicit Test::Unit / ActiveSupport adapter. As ActiveSupport::TestCase
|
19
19
|
introduces its own setup/teardown hooks, use these when autohooking in RR.
|
20
|
+
([#2][i2])
|
21
|
+
* Add support for Minitest 5
|
20
22
|
* Upon release, the tests are now packaged up and uploaded to S3. This is for
|
21
23
|
Linux distros like Fedora who wrap gems in RPM packages. You can always find
|
22
|
-
the latest tests at
|
24
|
+
the latest tests at <http://s3.amazonaws.com/rubygem-rr/tests/vX.Y.Z.tar.gz>,
|
23
25
|
where X.Y.Z represents a version. I have retroactively packaged the tests for
|
24
26
|
1.0.4 and 1.0.5.
|
25
|
-
* General cleanup and that sort of thing.
|
26
27
|
|
27
28
|
## 1.0.5 (2013-03-28)
|
28
29
|
|
@@ -30,12 +31,12 @@
|
|
30
31
|
works with RSpec-1 and a new one that works with RSpec-2. Currently, saying
|
31
32
|
`RSpec.configure {|c| c.mock_with(:rr) }` still uses RSpec-1; to use the new
|
32
33
|
one, you say `RSpec.configure {|c| c.mock_framework = RR::Adapters::RSpec2 }`.
|
33
|
-
(#66, #68, #80) [njay, james2m]
|
34
|
+
([#66][xi66], [#68][xi68], [#80][xi80]) [[@njay][njay], [@james2m][james2m]]
|
34
35
|
* Fix MethodMissingInjection so that `[stub].flatten` works without throwing a
|
35
|
-
NoMethodError (undefined method #to_ary) error under Ruby 1.9 (#44)
|
36
|
+
NoMethodError (undefined method #to_ary) error under Ruby 1.9 ([#44][xi44])
|
36
37
|
* Raise a MiniTest::Assertion error in the MiniTest adapter so that mock
|
37
38
|
failures appear in the output as failures rather than uncaught exceptions
|
38
|
-
(#69) [jayferd]
|
39
|
+
([#69][xi69]) [[@jayferd][jayferd]]
|
39
40
|
* Completely remove leftover #new_instance_of method, and also remove
|
40
41
|
mention of #new_instance_of from the README
|
41
42
|
* Fix tests so they all work and pass again
|
@@ -414,3 +415,17 @@
|
|
414
415
|
## 0.1.0 (2007-07-07)
|
415
416
|
|
416
417
|
* Initial Release
|
418
|
+
|
419
|
+
[i2]: http://github.com/rr/rr/issues/2
|
420
|
+
[i3]: http://github.com/rr/rr/issues/3
|
421
|
+
[Thibaut]: http://github.com/Thibaut
|
422
|
+
[i4]: http://github.com/rr/rr/issues/4
|
423
|
+
[xi66]: http://github.com/btakita/rr/issues/66
|
424
|
+
[xi68]: http://github.com/btakita/rr/issues/68
|
425
|
+
[xi80]: http://github.com/btakita/rr/issues/80
|
426
|
+
[njay]: http://github.com/njay
|
427
|
+
[james2m]: http://github.com/james2m
|
428
|
+
[xi44]: http://github.com/btakita/rr/issues/44
|
429
|
+
[xi69]: http://github.com/btakita/rr/issues/69
|
430
|
+
[jayferd]: http://github.com/jayferd
|
431
|
+
[autohook]: https://github.com/rr/rr/blob/master/lib/rr/autohook.rb
|
data/README.md
CHANGED
@@ -1,23 +1,51 @@
|
|
1
|
-
# RR [![Build Status](https://secure.travis-ci.org/rr/rr.png)](http://travis-ci.org/rr/rr)
|
1
|
+
# RR [![Build Status](https://secure.travis-ci.org/rr/rr.png)](http://travis-ci.org/rr/rr) [![Code Climate GPA](https://codeclimate.com/github/rr/rr.png)](https://codeclimate.com/github/rr/rr)
|
2
2
|
|
3
3
|
RR is a test double framework for Ruby that features a rich selection of double
|
4
4
|
techniques and a terse syntax.
|
5
5
|
|
6
6
|
|
7
|
-
##
|
7
|
+
## Installing RR into your project
|
8
8
|
|
9
|
-
|
9
|
+
For minimal setup, RR looks for an existing test framework and then hooks itself
|
10
|
+
into it. Hence, RR works best when loaded *after* the test framework that you
|
11
|
+
are using is loaded.
|
12
|
+
|
13
|
+
If you are using Bundler, you can achieve this by specifying the dependency on
|
14
|
+
RR with `require: false`; then, require RR directly following your test
|
15
|
+
framework.
|
16
|
+
|
17
|
+
Here's what this looks like for different kinds of projects:
|
18
|
+
|
19
|
+
### Ruby project (without Bundler)
|
10
20
|
|
11
21
|
~~~ ruby
|
12
|
-
|
22
|
+
require 'your/test/framework'
|
23
|
+
require 'rr'
|
13
24
|
~~~
|
14
25
|
|
15
|
-
|
26
|
+
### Ruby project (with Bundler)
|
16
27
|
|
17
28
|
~~~ ruby
|
29
|
+
# Gemfile
|
30
|
+
gem 'rr', require: false
|
31
|
+
|
32
|
+
# test helper
|
33
|
+
require 'your/test/framework'
|
34
|
+
require 'rr'
|
35
|
+
~~~
|
36
|
+
|
37
|
+
### Rails project
|
38
|
+
|
39
|
+
~~~ ruby
|
40
|
+
# Gemfile
|
18
41
|
group :test do
|
19
|
-
gem 'rr',
|
42
|
+
gem 'rr', require: false
|
20
43
|
end
|
44
|
+
|
45
|
+
# test helper
|
46
|
+
require File.expand_path('../../config/environment', __FILE__)
|
47
|
+
require 'your/test/framework' # if you are using something other than MiniTest / Test::Unit
|
48
|
+
require 'rr'
|
21
49
|
~~~
|
22
50
|
|
23
51
|
|
@@ -105,9 +133,8 @@ end
|
|
105
133
|
## Learning more
|
106
134
|
|
107
135
|
1. [What is a test double?](doc/01_test_double.md)
|
108
|
-
2. [
|
109
|
-
3. [
|
110
|
-
4. [API overview](doc/04_api_overview.md)
|
136
|
+
2. [Syntax between RR and other double/mock frameworks](doc/02_syntax_comparison.md)
|
137
|
+
3. [API overview](doc/03_api_overview.md)
|
111
138
|
|
112
139
|
|
113
140
|
## Help!
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.0.
|
1
|
+
1.1.0.rc3
|
data/lib/rr/adapters.rb
CHANGED
@@ -19,7 +19,7 @@ module RR
|
|
19
19
|
when :TestUnit
|
20
20
|
find_applicable_adapter(:TestUnit1, :TestUnit2ActiveSupport, :TestUnit2)
|
21
21
|
when :MiniTest
|
22
|
-
find_applicable_adapter(:
|
22
|
+
find_applicable_adapter(:MinitestActiveSupport, :Minitest, :MiniTest4ActiveSupport, :MiniTest4)
|
23
23
|
end
|
24
24
|
|
25
25
|
adapter
|
@@ -40,10 +40,7 @@ module RR
|
|
40
40
|
(class << mod; self; end).class_eval do
|
41
41
|
define_method(:included) do |base|
|
42
42
|
# Note: This assumes that the thing that is including this module
|
43
|
-
# is the same that the adapter detected and will hook into.
|
44
|
-
# most cases this will be true; in cases such as
|
45
|
-
# ActiveSupport::TestCase, well, either stop doing this, or
|
46
|
-
# require 'rr/without_autohook'.
|
43
|
+
# is the same that the adapter detected and will hook into.
|
47
44
|
adapter.hook
|
48
45
|
end
|
49
46
|
end
|
data/lib/rr/autohook.rb
CHANGED
@@ -6,13 +6,15 @@ module RR
|
|
6
6
|
:TestUnit1,
|
7
7
|
:TestUnit2ActiveSupport,
|
8
8
|
:TestUnit2,
|
9
|
-
:
|
10
|
-
:
|
9
|
+
:MiniTest4ActiveSupport,
|
10
|
+
:MiniTest4,
|
11
|
+
:MinitestActiveSupport,
|
12
|
+
:Minitest
|
11
13
|
]
|
12
14
|
|
13
15
|
def autohook
|
14
16
|
applicable_adapters.each do |adapter|
|
15
|
-
|
17
|
+
puts "Using adapter: #{adapter.name}" if RR.debug?
|
16
18
|
adapter.hook
|
17
19
|
end
|
18
20
|
end
|
@@ -1,44 +1,26 @@
|
|
1
1
|
module RR
|
2
2
|
module Integrations
|
3
|
-
class
|
4
|
-
module Mixin
|
5
|
-
def assert_received(subject, &block)
|
6
|
-
block.call(received(subject)).call
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
3
|
+
class Minitest < MiniTest4
|
10
4
|
def name
|
11
|
-
'
|
5
|
+
'Minitest'
|
12
6
|
end
|
13
7
|
|
14
8
|
def applies?
|
15
|
-
|
9
|
+
mt_version >= 5
|
10
|
+
rescue NameError
|
11
|
+
false
|
16
12
|
end
|
17
13
|
|
18
|
-
def
|
19
|
-
::
|
20
|
-
|
21
|
-
include Mixin
|
14
|
+
def test_case_class
|
15
|
+
::Minitest::Test
|
16
|
+
end
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
setup_without_rr
|
27
|
-
RR.reset
|
28
|
-
RR.trim_backtrace = true
|
29
|
-
RR.overridden_error_class = ::MiniTest::Assertion
|
30
|
-
end
|
31
|
-
alias_method :setup, :setup_with_rr
|
18
|
+
def assertion_error_class
|
19
|
+
::Minitest::Assertion
|
20
|
+
end
|
32
21
|
|
33
|
-
|
34
|
-
|
35
|
-
RR.verify
|
36
|
-
ensure
|
37
|
-
teardown_without_rr
|
38
|
-
end
|
39
|
-
alias_method :teardown, :teardown_with_rr
|
40
|
-
end
|
41
|
-
end
|
22
|
+
def version_constant
|
23
|
+
::Minitest::VERSION
|
42
24
|
end
|
43
25
|
end
|
44
26
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module RR
|
2
|
+
module Integrations
|
3
|
+
class MiniTest4
|
4
|
+
module Mixin
|
5
|
+
def assert_received(subject, &block)
|
6
|
+
block.call(received(subject)).call
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def name
|
11
|
+
'MiniTest 4'
|
12
|
+
end
|
13
|
+
|
14
|
+
def applies?
|
15
|
+
mt_version < 5
|
16
|
+
rescue NameError
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_case_class
|
21
|
+
::MiniTest::Unit::TestCase
|
22
|
+
end
|
23
|
+
|
24
|
+
def assertion_error_class
|
25
|
+
::MiniTest::Assertion
|
26
|
+
end
|
27
|
+
|
28
|
+
def version_constant
|
29
|
+
::MiniTest::Unit::VERSION
|
30
|
+
end
|
31
|
+
|
32
|
+
def mt_version
|
33
|
+
version_constant.split('.')[0].to_i
|
34
|
+
end
|
35
|
+
|
36
|
+
def hook
|
37
|
+
assertion_error_class = self.assertion_error_class
|
38
|
+
test_case_class.class_eval do
|
39
|
+
include RR::Adapters::RRMethods
|
40
|
+
include Mixin
|
41
|
+
|
42
|
+
unless instance_methods.any? { |method_name| method_name.to_sym == :setup_with_rr }
|
43
|
+
alias_method :setup_without_rr, :setup
|
44
|
+
define_method(:setup_with_rr) do
|
45
|
+
setup_without_rr
|
46
|
+
RR.reset
|
47
|
+
RR.trim_backtrace = true
|
48
|
+
RR.overridden_error_class = assertion_error_class
|
49
|
+
end
|
50
|
+
alias_method :setup, :setup_with_rr
|
51
|
+
|
52
|
+
alias_method :teardown_without_rr, :teardown
|
53
|
+
define_method(:teardown_with_rr) do
|
54
|
+
begin
|
55
|
+
RR.verify
|
56
|
+
ensure
|
57
|
+
teardown_without_rr
|
58
|
+
end
|
59
|
+
end
|
60
|
+
alias_method :teardown, :teardown_with_rr
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module RR
|
2
|
+
module Integrations
|
3
|
+
class MiniTest4ActiveSupport
|
4
|
+
def initialize
|
5
|
+
@mt_adapter = parent_adapter_class.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def parent_adapter_class
|
9
|
+
MiniTest4
|
10
|
+
end
|
11
|
+
|
12
|
+
def name
|
13
|
+
'MiniTest 4 + ActiveSupport'
|
14
|
+
end
|
15
|
+
|
16
|
+
def applies?
|
17
|
+
@mt_adapter.applies? && defined?(::ActiveSupport::TestCase)
|
18
|
+
end
|
19
|
+
|
20
|
+
def hook
|
21
|
+
parent_adapter_class = self.parent_adapter_class
|
22
|
+
::ActiveSupport::TestCase.class_eval do
|
23
|
+
include RR::Adapters::RRMethods
|
24
|
+
include parent_adapter_class::Mixin
|
25
|
+
|
26
|
+
setup do
|
27
|
+
RR.reset
|
28
|
+
RR.trim_backtrace = true
|
29
|
+
RR.overridden_error_class = ::ActiveSupport::TestCase::Assertion
|
30
|
+
end
|
31
|
+
|
32
|
+
teardown do
|
33
|
+
RR.verify
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -1,33 +1,12 @@
|
|
1
1
|
module RR
|
2
2
|
module Integrations
|
3
|
-
class
|
4
|
-
def
|
5
|
-
|
3
|
+
class MinitestActiveSupport < MiniTest4ActiveSupport
|
4
|
+
def parent_adapter_class
|
5
|
+
Minitest
|
6
6
|
end
|
7
7
|
|
8
8
|
def name
|
9
|
-
'
|
10
|
-
end
|
11
|
-
|
12
|
-
def applies?
|
13
|
-
@mt_adapter.applies? && defined?(::ActiveSupport::TestCase)
|
14
|
-
end
|
15
|
-
|
16
|
-
def hook
|
17
|
-
::ActiveSupport::TestCase.class_eval do
|
18
|
-
include RR::Adapters::RRMethods
|
19
|
-
include MiniTest::Mixin
|
20
|
-
|
21
|
-
setup do
|
22
|
-
RR.reset
|
23
|
-
RR.trim_backtrace = true
|
24
|
-
RR.overridden_error_class = ::ActiveSupport::TestCase::Assertion
|
25
|
-
end
|
26
|
-
|
27
|
-
teardown do
|
28
|
-
RR.verify
|
29
|
-
end
|
30
|
-
end
|
9
|
+
'Minitest + ActiveSupport'
|
31
10
|
end
|
32
11
|
end
|
33
12
|
end
|
data/lib/rr/without_autohook.rb
CHANGED
@@ -93,6 +93,8 @@ require 'rr/integrations/rspec_2'
|
|
93
93
|
require 'rr/integrations/test_unit_1'
|
94
94
|
require 'rr/integrations/test_unit_2'
|
95
95
|
require 'rr/integrations/test_unit_2_active_support'
|
96
|
+
require 'rr/integrations/minitest_4'
|
97
|
+
require 'rr/integrations/minitest_4_active_support'
|
96
98
|
require 'rr/integrations/minitest'
|
97
99
|
require 'rr/integrations/minitest_active_support'
|
98
100
|
require 'rr/integrations/none'
|
@@ -110,5 +112,10 @@ module RR
|
|
110
112
|
end
|
111
113
|
METHOD
|
112
114
|
end
|
115
|
+
|
116
|
+
attr_accessor :debug
|
117
|
+
alias_method :debug?, :debug
|
113
118
|
end
|
114
119
|
end
|
120
|
+
|
121
|
+
RR.debug = (ENV['RR_DEBUG'] == '1')
|
data/spec/suite.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
require 'session'
|
2
2
|
|
3
3
|
class SpecSuite
|
4
|
-
def self.def_runner(runner_name, runner_desc, &block)
|
4
|
+
def self.def_runner(runner_name, runner_desc, program_name, suffix, opts={}, &block)
|
5
|
+
adapter_name = opts[:adapter] || runner_name
|
6
|
+
path = opts[:path] || runner_name
|
7
|
+
env = opts[:env] || {}
|
5
8
|
runner_method = "run_#{runner_name}"
|
6
|
-
define_method(runner_method
|
9
|
+
define_method(runner_method) do
|
10
|
+
run_command(build_command(program_name, adapter_name, path, suffix, env))
|
11
|
+
end
|
7
12
|
runners << [runner_name, runner_desc]
|
8
13
|
end
|
9
14
|
|
@@ -46,30 +51,22 @@ class SpecSuite
|
|
46
51
|
end
|
47
52
|
|
48
53
|
if ruby_18?
|
49
|
-
def_runner :test_unit_1, 'Test::Unit 1'
|
50
|
-
run_command(build_command('ruby', 'test_unit_1', 'test'))
|
51
|
-
end
|
54
|
+
def_runner :test_unit_1, 'Test::Unit 1', 'ruby', 'test'
|
52
55
|
end
|
53
56
|
|
54
|
-
def_runner :test_unit_2, 'Test::Unit 2'
|
55
|
-
run_command(build_command('ruby', 'test_unit_2', 'test'))
|
56
|
-
end
|
57
|
+
def_runner :test_unit_2, 'Test::Unit 2', 'ruby', 'test'
|
57
58
|
|
58
59
|
unless ruby_18?
|
59
|
-
def_runner :
|
60
|
-
|
61
|
-
|
60
|
+
def_runner :minitest_4, 'MiniTest 4', 'ruby', 'test', :path => :minitest
|
61
|
+
|
62
|
+
def_runner :minitest, 'Minitest', 'ruby', 'test'
|
62
63
|
end
|
63
64
|
|
64
65
|
if ruby_18?
|
65
|
-
def_runner :rspec_1, 'RSpec 1'
|
66
|
-
run_command(build_command('spec', 'rspec_1', 'spec'))
|
67
|
-
end
|
66
|
+
def_runner :rspec_1, 'RSpec 1', 'spec', 'spec'
|
68
67
|
else
|
69
|
-
def_runner :rspec_2, 'RSpec 2'
|
70
|
-
|
71
|
-
run_command(build_command('rspec', 'rspec_2', 'spec'))
|
72
|
-
end
|
68
|
+
def_runner :rspec_2, 'RSpec 2', 'rspec', 'spec',
|
69
|
+
:env => {'SPEC_OPTS' => '--format progress'}
|
73
70
|
end
|
74
71
|
|
75
72
|
private
|
@@ -81,9 +78,10 @@ class SpecSuite
|
|
81
78
|
session
|
82
79
|
end
|
83
80
|
|
84
|
-
def build_command(program_name, adapter_name, suffix)
|
85
|
-
|
86
|
-
|
81
|
+
def build_command(program_name, adapter_name, path, suffix, env)
|
82
|
+
env = env.merge('ADAPTER' => adapter_name)
|
83
|
+
env.each {|k,v| ENV[k.to_s] = v.to_s }
|
84
|
+
file_list = build_file_list(path, suffix)
|
87
85
|
['bundle', 'exec', program_name, *file_list]
|
88
86
|
end
|
89
87
|
|
@@ -4,7 +4,7 @@ require 'tempfile'
|
|
4
4
|
|
5
5
|
module AdapterIntegrationTests
|
6
6
|
def debug?
|
7
|
-
|
7
|
+
RR.debug?
|
8
8
|
end
|
9
9
|
|
10
10
|
def run_fixture_tests(content)
|
@@ -42,7 +42,14 @@ module AdapterIntegrationTests
|
|
42
42
|
|
43
43
|
def bootstrap(opts={})
|
44
44
|
str = ""
|
45
|
-
|
45
|
+
if respond_to?(:adapter_name)
|
46
|
+
str << "ENV['ADAPTER'] = '#{adapter_name}'\n"
|
47
|
+
end
|
48
|
+
str << <<-EOT
|
49
|
+
require 'rubygems'
|
50
|
+
require 'bundler'
|
51
|
+
Bundler.setup(:default)
|
52
|
+
EOT
|
46
53
|
str << "require 'rr'\n" if opts[:include_rr_before]
|
47
54
|
str << <<-EOT
|
48
55
|
require '#{test_framework_path}'
|
@@ -72,9 +79,11 @@ module AdapterIntegrationTests
|
|
72
79
|
output.should match /1 failure/
|
73
80
|
end
|
74
81
|
|
75
|
-
|
76
|
-
|
77
|
-
|
82
|
+
if method_defined?(:include_adapter_test)
|
83
|
+
specify "it is still possible to include the adapter into the test framework manually" do
|
84
|
+
output = run_fixture_tests(include_adapter_test)
|
85
|
+
all_tests_should_pass(output)
|
86
|
+
end
|
78
87
|
end
|
79
88
|
|
80
89
|
if method_defined?(:include_adapter_where_rr_included_before_test_framework_test)
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require File.expand_path('../../test_helper', __FILE__)
|
2
2
|
require File.expand_path('../../../common/test_unit_tests', __FILE__)
|
3
3
|
|
4
|
-
|
4
|
+
test_case_superclass = (defined?(Minitest) && defined?(Minitest::VERSION)) ? \
|
5
|
+
Minitest::Test : \
|
6
|
+
MiniTest::Unit::TestCase
|
7
|
+
|
8
|
+
class MiniTestIntegrationTest < test_case_superclass
|
5
9
|
# Test::Unit compatibility
|
6
10
|
alias_method :assert_raise, :assert_raises
|
7
11
|
|
8
12
|
include TestUnitTests
|
9
|
-
|
10
|
-
def test_backtrace_tweaking
|
11
|
-
skip "test this later"
|
12
|
-
end
|
13
13
|
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
require File.expand_path('../../../common/adapter_integration_tests', __FILE__)
|
3
|
+
require File.expand_path('../../../common/rails_integration_test', __FILE__)
|
4
|
+
|
5
|
+
describe 'Integration between MiniTest 4 and Rails' do
|
6
|
+
def adapter_name
|
7
|
+
'minitest_4'
|
8
|
+
end
|
9
|
+
|
10
|
+
def additional_bootstrap
|
11
|
+
<<-EOT
|
12
|
+
require 'rails'
|
13
|
+
require 'active_support'
|
14
|
+
EOT
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_framework_path
|
18
|
+
'minitest/autorun'
|
19
|
+
end
|
20
|
+
|
21
|
+
def error_test
|
22
|
+
<<-EOT
|
23
|
+
#{bootstrap}
|
24
|
+
|
25
|
+
class FooTest < ActiveSupport::TestCase
|
26
|
+
def test_foo
|
27
|
+
object = Object.new
|
28
|
+
mock(object).foo
|
29
|
+
end
|
30
|
+
end
|
31
|
+
EOT
|
32
|
+
end
|
33
|
+
|
34
|
+
def include_adapter_test
|
35
|
+
<<-EOT
|
36
|
+
#{bootstrap}
|
37
|
+
|
38
|
+
class ActiveSupport::TestCase
|
39
|
+
include RR::Adapters::MiniTest
|
40
|
+
end
|
41
|
+
|
42
|
+
class FooTest < ActiveSupport::TestCase
|
43
|
+
def test_foo
|
44
|
+
object = Object.new
|
45
|
+
mock(object).foo
|
46
|
+
object.foo
|
47
|
+
end
|
48
|
+
end
|
49
|
+
EOT
|
50
|
+
end
|
51
|
+
|
52
|
+
def include_adapter_where_rr_included_before_test_framework_test
|
53
|
+
<<-EOT
|
54
|
+
#{bootstrap :include_rr_before => true}
|
55
|
+
|
56
|
+
class ActiveSupport::TestCase
|
57
|
+
include RR::Adapters::MiniTest
|
58
|
+
end
|
59
|
+
|
60
|
+
class FooTest < ActiveSupport::TestCase
|
61
|
+
def test_foo
|
62
|
+
object = Object.new
|
63
|
+
mock(object).foo
|
64
|
+
object.foo
|
65
|
+
end
|
66
|
+
end
|
67
|
+
EOT
|
68
|
+
end
|
69
|
+
|
70
|
+
include AdapterIntegrationTests
|
71
|
+
include IntegrationWithRails
|
72
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
require File.expand_path('../../../common/adapter_integration_tests', __FILE__)
|
3
|
+
|
4
|
+
describe 'MiniTest 4 integration' do
|
5
|
+
def adapter_name
|
6
|
+
'minitest_4'
|
7
|
+
end
|
8
|
+
|
9
|
+
def error_test
|
10
|
+
<<-EOT
|
11
|
+
#{bootstrap}
|
12
|
+
|
13
|
+
class FooTest < MiniTest::Unit::TestCase
|
14
|
+
def test_foo
|
15
|
+
object = Object.new
|
16
|
+
mock(object).foo
|
17
|
+
end
|
18
|
+
end
|
19
|
+
EOT
|
20
|
+
end
|
21
|
+
|
22
|
+
def include_adapter_test
|
23
|
+
<<-EOT
|
24
|
+
#{bootstrap}
|
25
|
+
|
26
|
+
class MiniTest::Unit::TestCase
|
27
|
+
include RR::Adapters::MiniTest
|
28
|
+
end
|
29
|
+
|
30
|
+
class FooTest < MiniTest::Unit::TestCase
|
31
|
+
def test_foo
|
32
|
+
object = Object.new
|
33
|
+
mock(object).foo
|
34
|
+
object.foo
|
35
|
+
end
|
36
|
+
end
|
37
|
+
EOT
|
38
|
+
end
|
39
|
+
|
40
|
+
def include_adapter_where_rr_included_before_test_framework_test
|
41
|
+
<<-EOT
|
42
|
+
#{bootstrap :include_rr_before => true}
|
43
|
+
|
44
|
+
class MiniTest::Unit::TestCase
|
45
|
+
include RR::Adapters::MiniTest
|
46
|
+
end
|
47
|
+
|
48
|
+
class FooTest < MiniTest::Unit::TestCase
|
49
|
+
def test_foo
|
50
|
+
object = Object.new
|
51
|
+
mock(object).foo
|
52
|
+
object.foo
|
53
|
+
end
|
54
|
+
end
|
55
|
+
EOT
|
56
|
+
end
|
57
|
+
|
58
|
+
include AdapterIntegrationTests
|
59
|
+
|
60
|
+
def adapter_name
|
61
|
+
'minitest_4'
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_framework_path
|
65
|
+
'minitest/autorun'
|
66
|
+
end
|
67
|
+
end
|
@@ -3,9 +3,6 @@ require File.expand_path('../../../common/adapter_integration_tests', __FILE__)
|
|
3
3
|
require File.expand_path('../../../common/rails_integration_test', __FILE__)
|
4
4
|
|
5
5
|
describe 'Integration between MiniTest and Rails' do
|
6
|
-
include AdapterIntegrationTests
|
7
|
-
include IntegrationWithRails
|
8
|
-
|
9
6
|
def additional_bootstrap
|
10
7
|
<<-EOT
|
11
8
|
require 'rails'
|
@@ -65,4 +62,7 @@ describe 'Integration between MiniTest and Rails' do
|
|
65
62
|
end
|
66
63
|
EOT
|
67
64
|
end
|
65
|
+
|
66
|
+
include AdapterIntegrationTests
|
67
|
+
include IntegrationWithRails
|
68
68
|
end
|
@@ -2,8 +2,6 @@ require File.expand_path('../../spec_helper', __FILE__)
|
|
2
2
|
require File.expand_path('../../../common/adapter_integration_tests', __FILE__)
|
3
3
|
|
4
4
|
describe 'MiniTest integration' do
|
5
|
-
include AdapterIntegrationTests
|
6
|
-
|
7
5
|
def test_framework_path
|
8
6
|
'minitest/autorun'
|
9
7
|
end
|
@@ -12,7 +10,7 @@ describe 'MiniTest integration' do
|
|
12
10
|
<<-EOT
|
13
11
|
#{bootstrap}
|
14
12
|
|
15
|
-
class FooTest <
|
13
|
+
class FooTest < Minitest::Test
|
16
14
|
def test_foo
|
17
15
|
object = Object.new
|
18
16
|
mock(object).foo
|
@@ -25,11 +23,11 @@ describe 'MiniTest integration' do
|
|
25
23
|
<<-EOT
|
26
24
|
#{bootstrap}
|
27
25
|
|
28
|
-
class
|
26
|
+
class Minitest::Test
|
29
27
|
include RR::Adapters::MiniTest
|
30
28
|
end
|
31
29
|
|
32
|
-
class FooTest <
|
30
|
+
class FooTest < Minitest::Test
|
33
31
|
def test_foo
|
34
32
|
object = Object.new
|
35
33
|
mock(object).foo
|
@@ -43,11 +41,11 @@ describe 'MiniTest integration' do
|
|
43
41
|
<<-EOT
|
44
42
|
#{bootstrap :include_rr_before => true}
|
45
43
|
|
46
|
-
class
|
44
|
+
class Minitest::Test
|
47
45
|
include RR::Adapters::MiniTest
|
48
46
|
end
|
49
47
|
|
50
|
-
class FooTest <
|
48
|
+
class FooTest < Minitest::Test
|
51
49
|
def test_foo
|
52
50
|
object = Object.new
|
53
51
|
mock(object).foo
|
@@ -56,4 +54,6 @@ describe 'MiniTest integration' do
|
|
56
54
|
end
|
57
55
|
EOT
|
58
56
|
end
|
57
|
+
|
58
|
+
include AdapterIntegrationTests
|
59
59
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0.
|
4
|
+
version: 1.1.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Takita
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-21 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: RR is a double framework that features a rich selection of double techniques
|
15
15
|
and a terse syntax.
|
@@ -76,6 +76,8 @@ files:
|
|
76
76
|
- lib/rr/injections/singleton_method_added_injection.rb
|
77
77
|
- lib/rr/integrations.rb
|
78
78
|
- lib/rr/integrations/minitest.rb
|
79
|
+
- lib/rr/integrations/minitest_4.rb
|
80
|
+
- lib/rr/integrations/minitest_4_active_support.rb
|
79
81
|
- lib/rr/integrations/minitest_active_support.rb
|
80
82
|
- lib/rr/integrations/none.rb
|
81
83
|
- lib/rr/integrations/rspec/invocation_matcher.rb
|
@@ -137,6 +139,8 @@ files:
|
|
137
139
|
- spec/suites/rspec_2/functional/strong_spec.rb
|
138
140
|
- spec/suites/rspec_2/functional/stub_spec.rb
|
139
141
|
- spec/suites/rspec_2/functional/wildcard_matchers_spec.rb
|
142
|
+
- spec/suites/rspec_2/integration/minitest_4_rails_spec.rb
|
143
|
+
- spec/suites/rspec_2/integration/minitest_4_spec.rb
|
140
144
|
- spec/suites/rspec_2/integration/minitest_rails_spec.rb
|
141
145
|
- spec/suites/rspec_2/integration/minitest_spec.rb
|
142
146
|
- spec/suites/rspec_2/integration/rspec_2_spec.rb
|
@@ -247,6 +251,8 @@ test_files:
|
|
247
251
|
- spec/suites/rspec_2/functional/strong_spec.rb
|
248
252
|
- spec/suites/rspec_2/functional/stub_spec.rb
|
249
253
|
- spec/suites/rspec_2/functional/wildcard_matchers_spec.rb
|
254
|
+
- spec/suites/rspec_2/integration/minitest_4_rails_spec.rb
|
255
|
+
- spec/suites/rspec_2/integration/minitest_4_spec.rb
|
250
256
|
- spec/suites/rspec_2/integration/minitest_rails_spec.rb
|
251
257
|
- spec/suites/rspec_2/integration/minitest_spec.rb
|
252
258
|
- spec/suites/rspec_2/integration/rspec_2_spec.rb
|