rr 1.1.1.rc1 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CREDITS.md +61 -0
- data/VERSION +1 -1
- data/doc/01_test_double.md +16 -0
- data/doc/02_syntax_comparison.md +96 -0
- data/doc/03_api_overview.md +616 -0
- data/rr.gemspec +6 -6
- metadata +12 -230
- data/spec/global_helper.rb +0 -53
- data/spec/spec.opts +0 -2
- data/spec/suite.rb +0 -107
- data/spec/suites/common/adapter_integration_tests.rb +0 -160
- data/spec/suites/common/adapter_tests.rb +0 -43
- data/spec/suites/common/rails_integration_tests.rb +0 -106
- data/spec/suites/common/test_unit_tests.rb +0 -21
- data/spec/suites/minitest/integration/minitest_test.rb +0 -13
- data/spec/suites/minitest/test_helper.rb +0 -7
- data/spec/suites/minitest_4/integration/minitest_test.rb +0 -13
- data/spec/suites/minitest_4/test_helper.rb +0 -7
- data/spec/suites/rspec_1/helper.rb +0 -24
- data/spec/suites/rspec_1/integration/rspec_1_spec.rb +0 -77
- data/spec/suites/rspec_1/integration/test_unit_1_spec.rb +0 -41
- data/spec/suites/rspec_1/integration/test_unit_2_spec.rb +0 -57
- data/spec/suites/rspec_1/spec_helper.rb +0 -3
- data/spec/suites/rspec_1_rails_2/integration/test_unit_1_rails_2_spec.rb +0 -53
- data/spec/suites/rspec_1_rails_2/integration/test_unit_2_rails_2_spec.rb +0 -57
- data/spec/suites/rspec_1_rails_2/spec_helper.rb +0 -3
- data/spec/suites/rspec_2/functional/any_instance_of_spec.rb +0 -47
- data/spec/suites/rspec_2/functional/dont_allow_spec.rb +0 -12
- data/spec/suites/rspec_2/functional/dsl_spec.rb +0 -13
- data/spec/suites/rspec_2/functional/instance_of_spec.rb +0 -14
- data/spec/suites/rspec_2/functional/mock_spec.rb +0 -241
- data/spec/suites/rspec_2/functional/proxy_spec.rb +0 -136
- data/spec/suites/rspec_2/functional/spy_spec.rb +0 -41
- data/spec/suites/rspec_2/functional/strong_spec.rb +0 -79
- data/spec/suites/rspec_2/functional/stub_spec.rb +0 -190
- data/spec/suites/rspec_2/functional/wildcard_matchers_spec.rb +0 -128
- data/spec/suites/rspec_2/helper.rb +0 -27
- data/spec/suites/rspec_2/integration/minitest_4_spec.rb +0 -57
- data/spec/suites/rspec_2/integration/minitest_spec.rb +0 -57
- data/spec/suites/rspec_2/integration/rspec_2_spec.rb +0 -126
- data/spec/suites/rspec_2/integration/test_unit_200_spec.rb +0 -57
- data/spec/suites/rspec_2/integration/test_unit_2_spec.rb +0 -57
- data/spec/suites/rspec_2/spec_helper.rb +0 -3
- data/spec/suites/rspec_2/support/matchers/wildcard_matcher_matchers.rb +0 -32
- data/spec/suites/rspec_2/support/shared_examples/space.rb +0 -13
- data/spec/suites/rspec_2/support/shared_examples/times_called_expectation.rb +0 -9
- data/spec/suites/rspec_2/unit/adapters/rr_methods/double_creators_spec.rb +0 -135
- data/spec/suites/rspec_2/unit/adapters/rr_methods/space_spec.rb +0 -101
- data/spec/suites/rspec_2/unit/adapters/rr_methods/wildcard_matchers_spec.rb +0 -69
- data/spec/suites/rspec_2/unit/core_ext/array_spec.rb +0 -39
- data/spec/suites/rspec_2/unit/core_ext/enumerable_spec.rb +0 -81
- data/spec/suites/rspec_2/unit/core_ext/hash_spec.rb +0 -55
- data/spec/suites/rspec_2/unit/core_ext/range_spec.rb +0 -41
- data/spec/suites/rspec_2/unit/core_ext/regexp_spec.rb +0 -41
- data/spec/suites/rspec_2/unit/double_definitions/child_double_definition_create_spec.rb +0 -114
- data/spec/suites/rspec_2/unit/double_definitions/double_definition_create_blank_slate_spec.rb +0 -93
- data/spec/suites/rspec_2/unit/double_definitions/double_definition_create_spec.rb +0 -446
- data/spec/suites/rspec_2/unit/errors/rr_error_spec.rb +0 -67
- data/spec/suites/rspec_2/unit/expectations/any_argument_expectation_spec.rb +0 -48
- data/spec/suites/rspec_2/unit/expectations/anything_argument_equality_expectation_spec.rb +0 -14
- data/spec/suites/rspec_2/unit/expectations/argument_equality_expectation_spec.rb +0 -135
- data/spec/suites/rspec_2/unit/expectations/boolean_argument_equality_expectation_spec.rb +0 -30
- data/spec/suites/rspec_2/unit/expectations/hash_including_argument_equality_expectation_spec.rb +0 -82
- data/spec/suites/rspec_2/unit/expectations/satisfy_argument_equality_expectation_spec.rb +0 -61
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/any_times_matcher_spec.rb +0 -22
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/at_least_matcher_spec.rb +0 -37
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/at_most_matcher_spec.rb +0 -43
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/integer_matcher_spec.rb +0 -58
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/proc_matcher_spec.rb +0 -35
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/range_matcher_spec.rb +0 -39
- data/spec/suites/rspec_2/unit/hash_with_object_id_key_spec.rb +0 -88
- data/spec/suites/rspec_2/unit/injections/double_injection/double_injection_spec.rb +0 -545
- data/spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb +0 -32
- data/spec/suites/rspec_2/unit/integrations/rspec/invocation_matcher_spec.rb +0 -297
- data/spec/suites/rspec_2/unit/integrations/rspec_spec.rb +0 -85
- data/spec/suites/rspec_2/unit/proc_from_block_spec.rb +0 -14
- data/spec/suites/rspec_2/unit/rr_spec.rb +0 -28
- data/spec/suites/rspec_2/unit/space_spec.rb +0 -595
- data/spec/suites/rspec_2/unit/spy_verification_spec.rb +0 -133
- data/spec/suites/rspec_2/unit/times_called_matchers/any_times_matcher_spec.rb +0 -46
- data/spec/suites/rspec_2/unit/times_called_matchers/at_least_matcher_spec.rb +0 -54
- data/spec/suites/rspec_2/unit/times_called_matchers/at_most_matcher_spec.rb +0 -69
- data/spec/suites/rspec_2/unit/times_called_matchers/integer_matcher_spec.rb +0 -69
- data/spec/suites/rspec_2/unit/times_called_matchers/proc_matcher_spec.rb +0 -54
- data/spec/suites/rspec_2/unit/times_called_matchers/range_matcher_spec.rb +0 -75
- data/spec/suites/rspec_2/unit/times_called_matchers/times_called_matcher_spec.rb +0 -117
- data/spec/suites/rspec_2/unit/wildcard_matchers/anything_spec.rb +0 -33
- data/spec/suites/rspec_2/unit/wildcard_matchers/boolean_spec.rb +0 -45
- data/spec/suites/rspec_2/unit/wildcard_matchers/duck_type_spec.rb +0 -64
- data/spec/suites/rspec_2/unit/wildcard_matchers/hash_including_spec.rb +0 -64
- data/spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb +0 -55
- data/spec/suites/rspec_2/unit/wildcard_matchers/numeric_spec.rb +0 -46
- data/spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb +0 -57
- data/spec/suites/rspec_2_rails_3/integration/minitest_4_rails_3_spec.rb +0 -66
- data/spec/suites/rspec_2_rails_3/integration/test_unit_200_rails_3_spec.rb +0 -66
- data/spec/suites/rspec_2_rails_3/integration/test_unit_2_rails_3_spec.rb +0 -66
- data/spec/suites/rspec_2_rails_3/spec_helper.rb +0 -3
- data/spec/suites/rspec_2_rails_4/integration/minitest_4_rails_4_spec.rb +0 -66
- data/spec/suites/rspec_2_rails_4/integration/rspec_2_rails_4_spec.rb +0 -156
- data/spec/suites/rspec_2_rails_4/integration/test_unit_200_rails_4_spec.rb +0 -66
- data/spec/suites/rspec_2_rails_4/integration/test_unit_2_rails_4_spec.rb +0 -66
- data/spec/suites/rspec_2_rails_4/spec_helper.rb +0 -3
- data/spec/suites/test_unit_1/integration/test_unit_1_test.rb +0 -10
- data/spec/suites/test_unit_1/test_helper.rb +0 -10
- data/spec/suites/test_unit_2/integration/test_unit_2_test.rb +0 -10
- data/spec/suites/test_unit_2/test_helper.rb +0 -6
- data/spec/suites/test_unit_200/integration/test_unit_200_test.rb +0 -10
- data/spec/suites/test_unit_200/test_helper.rb +0 -6
- data/spec/suites/test_unit_200_rails_3/integration/test_unit_200_rails_3_test.rb +0 -10
- data/spec/suites/test_unit_200_rails_3/test_helper.rb +0 -7
- data/spec/suites/test_unit_200_rails_4/integration/test_unit_200_rails_4_test.rb +0 -10
- data/spec/suites/test_unit_200_rails_4/test_helper.rb +0 -7
- data/spec/suites/test_unit_2_rails_2/integration/test_unit_2_rails_2_test.rb +0 -10
- data/spec/suites/test_unit_2_rails_2/test_helper.rb +0 -7
- data/spec/suites/test_unit_2_rails_3/integration/test_unit_2_rails_3_test.rb +0 -10
- data/spec/suites/test_unit_2_rails_3/test_helper.rb +0 -7
- data/spec/suites/test_unit_2_rails_4/integration/test_unit_2_rails_4_test.rb +0 -10
- data/spec/suites/test_unit_2_rails_4/test_helper.rb +0 -7
@@ -1,66 +0,0 @@
|
|
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_tests', __FILE__)
|
4
|
-
|
5
|
-
describe 'Integration with MiniTest 4 and Rails 3' do
|
6
|
-
def adapter_name
|
7
|
-
'minitest_4_rails_3'
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_framework_path
|
11
|
-
'minitest/autorun'
|
12
|
-
end
|
13
|
-
|
14
|
-
def before_require_test_framework
|
15
|
-
<<-EOT
|
16
|
-
require 'rails'
|
17
|
-
require 'active_support'
|
18
|
-
EOT
|
19
|
-
end
|
20
|
-
|
21
|
-
def error_test
|
22
|
-
with_bootstrap <<-EOT
|
23
|
-
class FooTest < ActiveSupport::TestCase
|
24
|
-
def test_foo
|
25
|
-
object = Object.new
|
26
|
-
mock(object).foo
|
27
|
-
end
|
28
|
-
end
|
29
|
-
EOT
|
30
|
-
end
|
31
|
-
|
32
|
-
def include_adapter_test
|
33
|
-
with_bootstrap <<-EOT
|
34
|
-
class ActiveSupport::TestCase
|
35
|
-
include RR::Adapters::MiniTest
|
36
|
-
end
|
37
|
-
|
38
|
-
class FooTest < ActiveSupport::TestCase
|
39
|
-
def test_foo
|
40
|
-
object = Object.new
|
41
|
-
mock(object).foo
|
42
|
-
object.foo
|
43
|
-
end
|
44
|
-
end
|
45
|
-
EOT
|
46
|
-
end
|
47
|
-
|
48
|
-
def include_adapter_where_rr_included_before_test_framework_test
|
49
|
-
with_bootstrap <<-EOT, :include_rr_before_test_framework => true
|
50
|
-
class ActiveSupport::TestCase
|
51
|
-
include RR::Adapters::MiniTest
|
52
|
-
end
|
53
|
-
|
54
|
-
class FooTest < ActiveSupport::TestCase
|
55
|
-
def test_foo
|
56
|
-
object = Object.new
|
57
|
-
mock(object).foo
|
58
|
-
object.foo
|
59
|
-
end
|
60
|
-
end
|
61
|
-
EOT
|
62
|
-
end
|
63
|
-
|
64
|
-
include AdapterIntegrationTests
|
65
|
-
include RailsIntegrationTests
|
66
|
-
end
|
@@ -1,66 +0,0 @@
|
|
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_tests', __FILE__)
|
4
|
-
|
5
|
-
describe 'Integration with Test::Unit 2.0.0 and Rails 3' do
|
6
|
-
def adapter_name
|
7
|
-
'test_unit_2_rails_3'
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_framework_path
|
11
|
-
'test/unit'
|
12
|
-
end
|
13
|
-
|
14
|
-
def before_require_test_framework
|
15
|
-
<<-EOT
|
16
|
-
require 'rails'
|
17
|
-
require 'active_support'
|
18
|
-
EOT
|
19
|
-
end
|
20
|
-
|
21
|
-
def error_test
|
22
|
-
with_bootstrap <<-EOT
|
23
|
-
class FooTest < ActiveSupport::TestCase
|
24
|
-
def test_foo
|
25
|
-
object = Object.new
|
26
|
-
mock(object).foo
|
27
|
-
end
|
28
|
-
end
|
29
|
-
EOT
|
30
|
-
end
|
31
|
-
|
32
|
-
def include_adapter_test
|
33
|
-
with_bootstrap <<-EOT
|
34
|
-
class ActiveSupport::TestCase
|
35
|
-
include RR::Adapters::TestUnit
|
36
|
-
end
|
37
|
-
|
38
|
-
class FooTest < ActiveSupport::TestCase
|
39
|
-
def test_foo
|
40
|
-
object = Object.new
|
41
|
-
mock(object).foo
|
42
|
-
object.foo
|
43
|
-
end
|
44
|
-
end
|
45
|
-
EOT
|
46
|
-
end
|
47
|
-
|
48
|
-
def include_adapter_where_rr_included_before_test_framework_test
|
49
|
-
with_bootstrap <<-EOT, :include_rr_before => true
|
50
|
-
class ActiveSupport::TestCase
|
51
|
-
include RR::Adapters::TestUnit
|
52
|
-
end
|
53
|
-
|
54
|
-
class FooTest < ActiveSupport::TestCase
|
55
|
-
def test_foo
|
56
|
-
object = Object.new
|
57
|
-
mock(object).foo
|
58
|
-
object.foo
|
59
|
-
end
|
60
|
-
end
|
61
|
-
EOT
|
62
|
-
end
|
63
|
-
|
64
|
-
include AdapterIntegrationTests
|
65
|
-
include RailsIntegrationTests
|
66
|
-
end
|
@@ -1,66 +0,0 @@
|
|
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_tests', __FILE__)
|
4
|
-
|
5
|
-
describe 'Integration with Test::Unit >= 2.5 and Rails 3' do
|
6
|
-
def adapter_name
|
7
|
-
'test_unit_2_rails_3'
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_framework_path
|
11
|
-
'test/unit'
|
12
|
-
end
|
13
|
-
|
14
|
-
def before_require_test_framework
|
15
|
-
<<-EOT
|
16
|
-
require 'rails'
|
17
|
-
require 'active_support'
|
18
|
-
EOT
|
19
|
-
end
|
20
|
-
|
21
|
-
def error_test
|
22
|
-
with_bootstrap <<-EOT
|
23
|
-
class FooTest < ActiveSupport::TestCase
|
24
|
-
def test_foo
|
25
|
-
object = Object.new
|
26
|
-
mock(object).foo
|
27
|
-
end
|
28
|
-
end
|
29
|
-
EOT
|
30
|
-
end
|
31
|
-
|
32
|
-
def include_adapter_test
|
33
|
-
with_bootstrap <<-EOT
|
34
|
-
class ActiveSupport::TestCase
|
35
|
-
include RR::Adapters::TestUnit
|
36
|
-
end
|
37
|
-
|
38
|
-
class FooTest < ActiveSupport::TestCase
|
39
|
-
def test_foo
|
40
|
-
object = Object.new
|
41
|
-
mock(object).foo
|
42
|
-
object.foo
|
43
|
-
end
|
44
|
-
end
|
45
|
-
EOT
|
46
|
-
end
|
47
|
-
|
48
|
-
def include_adapter_where_rr_included_before_test_framework_test
|
49
|
-
with_bootstrap <<-EOT, :include_rr_before => true
|
50
|
-
class ActiveSupport::TestCase
|
51
|
-
include RR::Adapters::TestUnit
|
52
|
-
end
|
53
|
-
|
54
|
-
class FooTest < ActiveSupport::TestCase
|
55
|
-
def test_foo
|
56
|
-
object = Object.new
|
57
|
-
mock(object).foo
|
58
|
-
object.foo
|
59
|
-
end
|
60
|
-
end
|
61
|
-
EOT
|
62
|
-
end
|
63
|
-
|
64
|
-
include AdapterIntegrationTests
|
65
|
-
include RailsIntegrationTests
|
66
|
-
end
|
@@ -1,66 +0,0 @@
|
|
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_tests', __FILE__)
|
4
|
-
|
5
|
-
describe 'Integration with MiniTest 4 and Rails 4' do
|
6
|
-
def adapter_name
|
7
|
-
'minitest_4_rails_3'
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_framework_path
|
11
|
-
'minitest/autorun'
|
12
|
-
end
|
13
|
-
|
14
|
-
def before_require_test_framework
|
15
|
-
<<-EOT
|
16
|
-
require 'rails'
|
17
|
-
require 'active_support'
|
18
|
-
EOT
|
19
|
-
end
|
20
|
-
|
21
|
-
def error_test
|
22
|
-
with_bootstrap <<-EOT
|
23
|
-
class FooTest < ActiveSupport::TestCase
|
24
|
-
def test_foo
|
25
|
-
object = Object.new
|
26
|
-
mock(object).foo
|
27
|
-
end
|
28
|
-
end
|
29
|
-
EOT
|
30
|
-
end
|
31
|
-
|
32
|
-
def include_adapter_test
|
33
|
-
with_bootstrap <<-EOT
|
34
|
-
class ActiveSupport::TestCase
|
35
|
-
include RR::Adapters::MiniTest
|
36
|
-
end
|
37
|
-
|
38
|
-
class FooTest < ActiveSupport::TestCase
|
39
|
-
def test_foo
|
40
|
-
object = Object.new
|
41
|
-
mock(object).foo
|
42
|
-
object.foo
|
43
|
-
end
|
44
|
-
end
|
45
|
-
EOT
|
46
|
-
end
|
47
|
-
|
48
|
-
def include_adapter_where_rr_included_before_test_framework_test
|
49
|
-
with_bootstrap <<-EOT, :include_rr_before_test_framework => true
|
50
|
-
class ActiveSupport::TestCase
|
51
|
-
include RR::Adapters::MiniTest
|
52
|
-
end
|
53
|
-
|
54
|
-
class FooTest < ActiveSupport::TestCase
|
55
|
-
def test_foo
|
56
|
-
object = Object.new
|
57
|
-
mock(object).foo
|
58
|
-
object.foo
|
59
|
-
end
|
60
|
-
end
|
61
|
-
EOT
|
62
|
-
end
|
63
|
-
|
64
|
-
include AdapterIntegrationTests
|
65
|
-
include RailsIntegrationTests
|
66
|
-
end
|
@@ -1,156 +0,0 @@
|
|
1
|
-
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
-
require File.expand_path('../../../common/adapter_tests', __FILE__)
|
3
|
-
require File.expand_path('../../../common/adapter_integration_tests', __FILE__)
|
4
|
-
require File.expand_path('../../../common/rails_integration_tests', __FILE__)
|
5
|
-
|
6
|
-
describe 'Integration with RSpec 2 and Rails 4' do
|
7
|
-
def assert_equal(expected, actual)
|
8
|
-
expect(actual).to eq actual
|
9
|
-
end
|
10
|
-
|
11
|
-
def assert_raise(error, message=nil, &block)
|
12
|
-
expect(&block).to raise_error(error, message)
|
13
|
-
end
|
14
|
-
|
15
|
-
def adapter_name
|
16
|
-
'rspec_2_rails_4'
|
17
|
-
end
|
18
|
-
|
19
|
-
def applicable_adapter_names
|
20
|
-
[:RSpec2]
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_framework_path
|
24
|
-
%w(rspec/autorun rspec/rails)
|
25
|
-
end
|
26
|
-
|
27
|
-
def before_require_test_framework
|
28
|
-
<<-EOT
|
29
|
-
require 'rails/all'
|
30
|
-
#require 'active_support'
|
31
|
-
#require 'active_support/test_case'
|
32
|
-
EOT
|
33
|
-
end
|
34
|
-
|
35
|
-
def after_require_test_framework
|
36
|
-
<<-EOT
|
37
|
-
RSpec.configure do |c|
|
38
|
-
c.use_transactional_fixtures = true
|
39
|
-
end
|
40
|
-
EOT
|
41
|
-
end
|
42
|
-
|
43
|
-
def error_test
|
44
|
-
with_bootstrap <<-EOT
|
45
|
-
describe 'A test' do
|
46
|
-
it 'is a test' do
|
47
|
-
object = Object.new
|
48
|
-
mock(object).foo
|
49
|
-
end
|
50
|
-
end
|
51
|
-
EOT
|
52
|
-
end
|
53
|
-
|
54
|
-
def include_adapter_test
|
55
|
-
with_bootstrap <<-EOT
|
56
|
-
RSpec.configure do |c|
|
57
|
-
c.mock_with :rr
|
58
|
-
end
|
59
|
-
|
60
|
-
describe 'A test' do
|
61
|
-
it 'is a test' do
|
62
|
-
object = Object.new
|
63
|
-
mock(object).foo
|
64
|
-
object.foo
|
65
|
-
end
|
66
|
-
end
|
67
|
-
EOT
|
68
|
-
end
|
69
|
-
|
70
|
-
def include_adapter_where_rr_included_before_test_framework_test
|
71
|
-
with_bootstrap <<-EOT, :include_rr_before_test_framework => true
|
72
|
-
RSpec.configure do |c|
|
73
|
-
c.mock_with :rr
|
74
|
-
end
|
75
|
-
|
76
|
-
describe 'A test' do
|
77
|
-
it 'is a test' do
|
78
|
-
object = Object.new
|
79
|
-
mock(object).foo
|
80
|
-
object.foo
|
81
|
-
end
|
82
|
-
end
|
83
|
-
EOT
|
84
|
-
end
|
85
|
-
|
86
|
-
def database_properly_rolled_back_test
|
87
|
-
with_active_record_bootstrap <<-EOT
|
88
|
-
describe Person do
|
89
|
-
it 'is a test' do
|
90
|
-
Person.create!(:name => 'Joe Blow')
|
91
|
-
object = Object.new
|
92
|
-
mock(object).foo
|
93
|
-
end
|
94
|
-
end
|
95
|
-
EOT
|
96
|
-
end
|
97
|
-
|
98
|
-
specify "it is still possible to use a custom RSpec-2 adapter" do
|
99
|
-
suite = with_bootstrap <<-EOT
|
100
|
-
module RR
|
101
|
-
module Adapters
|
102
|
-
module RSpec2
|
103
|
-
include RRMethods
|
104
|
-
|
105
|
-
def setup_mocks_for_rspec
|
106
|
-
RR.reset
|
107
|
-
end
|
108
|
-
|
109
|
-
def verify_mocks_for_rspec
|
110
|
-
RR.verify
|
111
|
-
end
|
112
|
-
|
113
|
-
def teardown_mocks_for_rspec
|
114
|
-
RR.reset
|
115
|
-
end
|
116
|
-
|
117
|
-
def have_received(method = nil)
|
118
|
-
RR::Adapters::Rspec::InvocationMatcher.new(method)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
RSpec.configure do |c|
|
125
|
-
c.mock_with RR::Adapters::RSpec2
|
126
|
-
end
|
127
|
-
|
128
|
-
describe 'RR' do
|
129
|
-
specify 'mocks work' do
|
130
|
-
object = Object.new
|
131
|
-
mock(object).foo
|
132
|
-
object.foo
|
133
|
-
end
|
134
|
-
|
135
|
-
specify 'have_received works' do
|
136
|
-
object = Object.new
|
137
|
-
stub(object).foo
|
138
|
-
object.foo
|
139
|
-
object.should have_received.foo
|
140
|
-
end
|
141
|
-
end
|
142
|
-
EOT
|
143
|
-
output = run_fixture_tests(suite)
|
144
|
-
all_tests_should_pass(output)
|
145
|
-
end
|
146
|
-
|
147
|
-
include AdapterTests
|
148
|
-
instance_methods.each do |method_name|
|
149
|
-
if method_name =~ /^test_(.+)$/
|
150
|
-
it(method_name) { __send__(method_name) }
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
include AdapterIntegrationTests
|
155
|
-
include RailsIntegrationTests
|
156
|
-
end
|
@@ -1,66 +0,0 @@
|
|
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_tests', __FILE__)
|
4
|
-
|
5
|
-
describe 'Integration with Test::Unit 2.0.0 and Rails 4' do
|
6
|
-
def adapter_name
|
7
|
-
'test_unit_2_rails_3'
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_framework_path
|
11
|
-
'test/unit'
|
12
|
-
end
|
13
|
-
|
14
|
-
def before_require_test_framework
|
15
|
-
<<-EOT
|
16
|
-
require 'rails'
|
17
|
-
require 'active_support'
|
18
|
-
EOT
|
19
|
-
end
|
20
|
-
|
21
|
-
def error_test
|
22
|
-
with_bootstrap <<-EOT
|
23
|
-
class FooTest < ActiveSupport::TestCase
|
24
|
-
def test_foo
|
25
|
-
object = Object.new
|
26
|
-
mock(object).foo
|
27
|
-
end
|
28
|
-
end
|
29
|
-
EOT
|
30
|
-
end
|
31
|
-
|
32
|
-
def include_adapter_test
|
33
|
-
with_bootstrap <<-EOT
|
34
|
-
class ActiveSupport::TestCase
|
35
|
-
include RR::Adapters::TestUnit
|
36
|
-
end
|
37
|
-
|
38
|
-
class FooTest < ActiveSupport::TestCase
|
39
|
-
def test_foo
|
40
|
-
object = Object.new
|
41
|
-
mock(object).foo
|
42
|
-
object.foo
|
43
|
-
end
|
44
|
-
end
|
45
|
-
EOT
|
46
|
-
end
|
47
|
-
|
48
|
-
def include_adapter_where_rr_included_before_test_framework_test
|
49
|
-
with_bootstrap <<-EOT, :include_rr_before => true
|
50
|
-
class ActiveSupport::TestCase
|
51
|
-
include RR::Adapters::TestUnit
|
52
|
-
end
|
53
|
-
|
54
|
-
class FooTest < ActiveSupport::TestCase
|
55
|
-
def test_foo
|
56
|
-
object = Object.new
|
57
|
-
mock(object).foo
|
58
|
-
object.foo
|
59
|
-
end
|
60
|
-
end
|
61
|
-
EOT
|
62
|
-
end
|
63
|
-
|
64
|
-
include AdapterIntegrationTests
|
65
|
-
include RailsIntegrationTests
|
66
|
-
end
|