rr 1.1.0.rc1 → 1.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/rr/adapters.rb +64 -0
  4. data/lib/rr/autohook.rb +6 -13
  5. data/lib/rr/integrations.rb +7 -0
  6. data/lib/rr/{adapters → integrations}/minitest.rb +4 -4
  7. data/lib/rr/{adapters → integrations}/minitest_active_support.rb +4 -4
  8. data/lib/rr/{adapters → integrations}/none.rb +1 -1
  9. data/lib/rr/{adapters → integrations}/rspec/invocation_matcher.rb +9 -1
  10. data/lib/rr/{adapters → integrations}/rspec_1.rb +4 -4
  11. data/lib/rr/{adapters → integrations}/rspec_2.rb +3 -3
  12. data/lib/rr/{adapters → integrations}/test_unit_1.rb +4 -4
  13. data/lib/rr/{adapters → integrations}/test_unit_2.rb +1 -1
  14. data/lib/rr/{adapters → integrations}/test_unit_2_active_support.rb +3 -3
  15. data/lib/rr/without_autohook.rb +11 -9
  16. data/spec/suites/common/adapter_integration_tests.rb +88 -0
  17. data/spec/suites/common/rails_integration_test.rb +0 -51
  18. data/spec/suites/rspec_1/integration/rspec_1_spec.rb +59 -4
  19. data/spec/suites/rspec_1/integration/test_unit_1_rails_spec.rb +36 -1
  20. data/spec/suites/rspec_1/integration/test_unit_1_spec.rb +45 -0
  21. data/spec/suites/rspec_1/integration/test_unit_2_rails_spec.rb +60 -3
  22. data/spec/suites/rspec_1/integration/test_unit_2_spec.rb +64 -0
  23. data/spec/suites/rspec_2/integration/minitest_rails_spec.rb +56 -3
  24. data/spec/suites/rspec_2/integration/minitest_spec.rb +59 -0
  25. data/spec/suites/rspec_2/integration/rspec_2_spec.rb +109 -4
  26. data/spec/suites/rspec_2/integration/test_unit_rails_spec.rb +57 -3
  27. data/spec/suites/rspec_2/integration/test_unit_spec.rb +59 -0
  28. data/spec/suites/rspec_2/unit/{adapters → integrations}/rspec/invocation_matcher_spec.rb +1 -1
  29. data/spec/suites/rspec_2/unit/{adapters → integrations}/rspec_spec.rb +6 -6
  30. metadata +27 -15
@@ -1,8 +1,16 @@
1
1
  require File.expand_path('../../spec_helper', __FILE__)
2
2
  require File.expand_path('../../../common/adapter_tests', __FILE__)
3
+ require File.expand_path('../../../common/adapter_integration_tests', __FILE__)
3
4
 
4
5
  describe 'Integration with RSpec 1' do
5
6
  include AdapterTests
7
+ instance_methods.each do |method_name|
8
+ if method_name =~ /^test_(.+)$/
9
+ it(method_name) { __send__(method_name) }
10
+ end
11
+ end
12
+
13
+ include AdapterIntegrationTests
6
14
 
7
15
  def assert_equal(expected, actual)
8
16
  actual.should be == expected
@@ -12,9 +20,56 @@ describe 'Integration with RSpec 1' do
12
20
  expect(&block).to raise_error(error, message)
13
21
  end
14
22
 
15
- instance_methods.each do |method_name|
16
- if method_name =~ /^test_(.+)$/
17
- it(method_name) { __send__(method_name) }
18
- end
23
+ def test_framework_path
24
+ 'spec/autorun'
25
+ end
26
+
27
+ def error_test
28
+ <<-EOT
29
+ #{bootstrap}
30
+
31
+ describe 'A test' do
32
+ it 'is a test' do
33
+ object = Object.new
34
+ mock(object).foo
35
+ end
36
+ end
37
+ EOT
38
+ end
39
+
40
+ def include_adapter_test
41
+ <<-EOT
42
+ #{bootstrap}
43
+
44
+ Spec::Runner.configure do |c|
45
+ c.mock_with :rr
46
+ end
47
+
48
+ describe 'A test' do
49
+ it 'is a test' do
50
+ object = Object.new
51
+ mock(object).foo
52
+ object.foo
53
+ end
54
+ end
55
+ EOT
56
+ end
57
+
58
+ def include_adapter_where_rr_included_before_test_framework_test
59
+ <<-EOT
60
+ #{bootstrap :include_rr_before => true}
61
+
62
+ Spec::Runner.configure do |c|
63
+ c.mock_with :rr
64
+ end
65
+
66
+ describe 'A test' do
67
+ it 'is a test' do
68
+ object = Object.new
69
+ mock(object).foo
70
+ object.foo
71
+ end
72
+ end
73
+ EOT
19
74
  end
20
75
  end
@@ -1,7 +1,9 @@
1
1
  require File.expand_path('../../spec_helper', __FILE__)
2
+ require File.expand_path('../../../common/adapter_integration_tests', __FILE__)
2
3
  require File.expand_path('../../../common/rails_integration_test', __FILE__)
3
4
 
4
- describe 'Integration between TestUnit and Rails' do
5
+ describe 'Integration between TestUnit 1 and Rails' do
6
+ include AdapterIntegrationTests
5
7
  include IntegrationWithRails
6
8
 
7
9
  def bootstrap
@@ -14,6 +16,39 @@ describe 'Integration between TestUnit and Rails' do
14
16
  require 'active_support/all'
15
17
  require 'action_controller'
16
18
  require 'active_support/test_case'
19
+
20
+ require 'rr'
21
+ EOT
22
+ end
23
+
24
+ def error_test
25
+ <<-EOT
26
+ #{bootstrap}
27
+
28
+ class FooTest < ActiveSupport::TestCase
29
+ def test_foo
30
+ object = Object.new
31
+ mock(object).foo
32
+ end
33
+ end
34
+ EOT
35
+ end
36
+
37
+ def include_adapter_test
38
+ <<-EOT
39
+ #{bootstrap}
40
+
41
+ class ActiveSupport::TestCase
42
+ include RR::Adapters::TestUnit
43
+ end
44
+
45
+ class FooTest < ActiveSupport::TestCase
46
+ def test_foo
47
+ object = Object.new
48
+ mock(object).foo
49
+ object.foo
50
+ end
51
+ end
17
52
  EOT
18
53
  end
19
54
  end
@@ -0,0 +1,45 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+ require File.expand_path('../../../common/adapter_integration_tests', __FILE__)
3
+
4
+ describe 'Test::Unit 1 integration' do
5
+ include AdapterIntegrationTests
6
+
7
+ def bootstrap
8
+ <<-EOT
9
+ require 'test/unit'
10
+ require 'rubygems'
11
+ require 'rr'
12
+ EOT
13
+ end
14
+
15
+ def error_test
16
+ <<-EOT
17
+ #{bootstrap}
18
+
19
+ class FooTest < Test::Unit::TestCase
20
+ def test_foo
21
+ object = Object.new
22
+ mock(object).foo
23
+ end
24
+ end
25
+ EOT
26
+ end
27
+
28
+ def include_adapter_test
29
+ <<-EOT
30
+ #{bootstrap}
31
+
32
+ class Test::Unit::TestCase
33
+ include RR::Adapters::TestUnit
34
+ end
35
+
36
+ class FooTest < Test::Unit::TestCase
37
+ def test_foo
38
+ object = Object.new
39
+ mock(object).foo
40
+ object.foo
41
+ end
42
+ end
43
+ EOT
44
+ end
45
+ end
@@ -1,18 +1,75 @@
1
1
  require File.expand_path('../../spec_helper', __FILE__)
2
+ require File.expand_path('../../../common/adapter_integration_tests', __FILE__)
2
3
  require File.expand_path('../../../common/rails_integration_test', __FILE__)
3
4
 
4
- describe 'Integration between TestUnit and Rails' do
5
+ describe 'Integration between TestUnit 2 and Rails' do
6
+ include AdapterIntegrationTests
5
7
  include IntegrationWithRails
6
8
 
7
- def bootstrap
8
- <<-EOT
9
+ def bootstrap(opts={})
10
+ str = ""
11
+ str << <<-EOT
9
12
  RAILS_ROOT = File.expand_path(__FILE__)
10
13
  require 'rubygems'
14
+ EOT
15
+ str << "require 'rr'\n" if opts[:include_rr_before]
16
+ str << <<-EOT
11
17
  require 'rack'
12
18
  require 'test/unit'
13
19
  require 'active_support/all'
14
20
  require 'action_controller'
15
21
  require 'active_support/test_case'
16
22
  EOT
23
+ str << "require 'rr'\n" unless opts[:include_rr_before]
24
+ str
25
+ end
26
+
27
+ def error_test
28
+ <<-EOT
29
+ #{bootstrap}
30
+
31
+ class FooTest < ActiveSupport::TestCase
32
+ def test_foo
33
+ object = Object.new
34
+ mock(object).foo
35
+ end
36
+ end
37
+ EOT
38
+ end
39
+
40
+ def include_adapter_test
41
+ <<-EOT
42
+ #{bootstrap}
43
+
44
+ class ActiveSupport::TestCase
45
+ include RR::Adapters::TestUnit
46
+ end
47
+
48
+ class FooTest < ActiveSupport::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
+ def include_adapter_where_rr_included_before_test_framework_test
59
+ <<-EOT
60
+ #{bootstrap :include_rr_before => true}
61
+
62
+ class ActiveSupport::TestCase
63
+ include RR::Adapters::TestUnit
64
+ end
65
+
66
+ class FooTest < ActiveSupport::TestCase
67
+ def test_foo
68
+ object = Object.new
69
+ mock(object).foo
70
+ object.foo
71
+ end
72
+ end
73
+ EOT
17
74
  end
18
75
  end
@@ -0,0 +1,64 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+ require File.expand_path('../../../common/adapter_integration_tests', __FILE__)
3
+
4
+ describe 'Test::Unit 2 integration' do
5
+ include AdapterIntegrationTests
6
+
7
+ def bootstrap(opts={})
8
+ str = ""
9
+ str << "require 'rubygems'\n"
10
+ str << "require 'rr'\n" if opts[:include_rr_before]
11
+ str << "require 'test/unit'\n"
12
+ str << "require 'rr'\n" unless opts[:include_rr_before]
13
+ str
14
+ end
15
+
16
+ def error_test
17
+ <<-EOT
18
+ #{bootstrap}
19
+
20
+ class FooTest < Test::Unit::TestCase
21
+ def test_foo
22
+ object = Object.new
23
+ mock(object).foo
24
+ end
25
+ end
26
+ EOT
27
+ end
28
+
29
+ def include_adapter_test
30
+ <<-EOT
31
+ #{bootstrap}
32
+
33
+ class Test::Unit::TestCase
34
+ include RR::Adapters::TestUnit
35
+ end
36
+
37
+ class FooTest < Test::Unit::TestCase
38
+ def test_foo
39
+ object = Object.new
40
+ mock(object).foo
41
+ object.foo
42
+ end
43
+ end
44
+ EOT
45
+ end
46
+
47
+ def include_adapter_where_rr_included_before_test_framework_test
48
+ <<-EOT
49
+ #{bootstrap :include_rr_before => true}
50
+
51
+ class Test::Unit::TestCase
52
+ include RR::Adapters::TestUnit
53
+ end
54
+
55
+ class FooTest < Test::Unit::TestCase
56
+ def test_foo
57
+ object = Object.new
58
+ mock(object).foo
59
+ object.foo
60
+ end
61
+ end
62
+ EOT
63
+ end
64
+ end
@@ -1,15 +1,68 @@
1
1
  require File.expand_path('../../spec_helper', __FILE__)
2
+ require File.expand_path('../../../common/adapter_integration_tests', __FILE__)
2
3
  require File.expand_path('../../../common/rails_integration_test', __FILE__)
3
4
 
4
5
  describe 'Integration between MiniTest and Rails' do
6
+ include AdapterIntegrationTests
5
7
  include IntegrationWithRails
6
8
 
7
- def bootstrap
9
+ def additional_bootstrap
8
10
  <<-EOT
9
- require 'rubygems'
10
- require 'minitest/unit'
11
11
  require 'rails'
12
12
  require 'active_support'
13
13
  EOT
14
14
  end
15
+
16
+ def test_framework_path
17
+ 'minitest/autorun'
18
+ end
19
+
20
+ def error_test
21
+ <<-EOT
22
+ #{bootstrap}
23
+
24
+ class FooTest < ActiveSupport::TestCase
25
+ def test_foo
26
+ object = Object.new
27
+ mock(object).foo
28
+ end
29
+ end
30
+ EOT
31
+ end
32
+
33
+ def include_adapter_test
34
+ <<-EOT
35
+ #{bootstrap}
36
+
37
+ class ActiveSupport::TestCase
38
+ include RR::Adapters::MiniTest
39
+ end
40
+
41
+ class FooTest < ActiveSupport::TestCase
42
+ def test_foo
43
+ object = Object.new
44
+ mock(object).foo
45
+ object.foo
46
+ end
47
+ end
48
+ EOT
49
+ end
50
+
51
+ def include_adapter_where_rr_included_before_test_framework_test
52
+ <<-EOT
53
+ #{bootstrap :include_rr_before => true}
54
+
55
+ class ActiveSupport::TestCase
56
+ include RR::Adapters::MiniTest
57
+ end
58
+
59
+ class FooTest < ActiveSupport::TestCase
60
+ def test_foo
61
+ object = Object.new
62
+ mock(object).foo
63
+ object.foo
64
+ end
65
+ end
66
+ EOT
67
+ end
15
68
  end
@@ -0,0 +1,59 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+ require File.expand_path('../../../common/adapter_integration_tests', __FILE__)
3
+
4
+ describe 'MiniTest integration' do
5
+ include AdapterIntegrationTests
6
+
7
+ def test_framework_path
8
+ 'minitest/autorun'
9
+ end
10
+
11
+ def error_test
12
+ <<-EOT
13
+ #{bootstrap}
14
+
15
+ class FooTest < MiniTest::Unit::TestCase
16
+ def test_foo
17
+ object = Object.new
18
+ mock(object).foo
19
+ end
20
+ end
21
+ EOT
22
+ end
23
+
24
+ def include_adapter_test
25
+ <<-EOT
26
+ #{bootstrap}
27
+
28
+ class MiniTest::Unit::TestCase
29
+ include RR::Adapters::MiniTest
30
+ end
31
+
32
+ class FooTest < MiniTest::Unit::TestCase
33
+ def test_foo
34
+ object = Object.new
35
+ mock(object).foo
36
+ object.foo
37
+ end
38
+ end
39
+ EOT
40
+ end
41
+
42
+ def include_adapter_where_rr_included_before_test_framework_test
43
+ <<-EOT
44
+ #{bootstrap :include_rr_before => true}
45
+
46
+ class MiniTest::Unit::TestCase
47
+ include RR::Adapters::MiniTest
48
+ end
49
+
50
+ class FooTest < MiniTest::Unit::TestCase
51
+ def test_foo
52
+ object = Object.new
53
+ mock(object).foo
54
+ object.foo
55
+ end
56
+ end
57
+ EOT
58
+ end
59
+ end