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.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/CREDITS.md +61 -0
  3. data/VERSION +1 -1
  4. data/doc/01_test_double.md +16 -0
  5. data/doc/02_syntax_comparison.md +96 -0
  6. data/doc/03_api_overview.md +616 -0
  7. data/rr.gemspec +6 -6
  8. metadata +12 -230
  9. data/spec/global_helper.rb +0 -53
  10. data/spec/spec.opts +0 -2
  11. data/spec/suite.rb +0 -107
  12. data/spec/suites/common/adapter_integration_tests.rb +0 -160
  13. data/spec/suites/common/adapter_tests.rb +0 -43
  14. data/spec/suites/common/rails_integration_tests.rb +0 -106
  15. data/spec/suites/common/test_unit_tests.rb +0 -21
  16. data/spec/suites/minitest/integration/minitest_test.rb +0 -13
  17. data/spec/suites/minitest/test_helper.rb +0 -7
  18. data/spec/suites/minitest_4/integration/minitest_test.rb +0 -13
  19. data/spec/suites/minitest_4/test_helper.rb +0 -7
  20. data/spec/suites/rspec_1/helper.rb +0 -24
  21. data/spec/suites/rspec_1/integration/rspec_1_spec.rb +0 -77
  22. data/spec/suites/rspec_1/integration/test_unit_1_spec.rb +0 -41
  23. data/spec/suites/rspec_1/integration/test_unit_2_spec.rb +0 -57
  24. data/spec/suites/rspec_1/spec_helper.rb +0 -3
  25. data/spec/suites/rspec_1_rails_2/integration/test_unit_1_rails_2_spec.rb +0 -53
  26. data/spec/suites/rspec_1_rails_2/integration/test_unit_2_rails_2_spec.rb +0 -57
  27. data/spec/suites/rspec_1_rails_2/spec_helper.rb +0 -3
  28. data/spec/suites/rspec_2/functional/any_instance_of_spec.rb +0 -47
  29. data/spec/suites/rspec_2/functional/dont_allow_spec.rb +0 -12
  30. data/spec/suites/rspec_2/functional/dsl_spec.rb +0 -13
  31. data/spec/suites/rspec_2/functional/instance_of_spec.rb +0 -14
  32. data/spec/suites/rspec_2/functional/mock_spec.rb +0 -241
  33. data/spec/suites/rspec_2/functional/proxy_spec.rb +0 -136
  34. data/spec/suites/rspec_2/functional/spy_spec.rb +0 -41
  35. data/spec/suites/rspec_2/functional/strong_spec.rb +0 -79
  36. data/spec/suites/rspec_2/functional/stub_spec.rb +0 -190
  37. data/spec/suites/rspec_2/functional/wildcard_matchers_spec.rb +0 -128
  38. data/spec/suites/rspec_2/helper.rb +0 -27
  39. data/spec/suites/rspec_2/integration/minitest_4_spec.rb +0 -57
  40. data/spec/suites/rspec_2/integration/minitest_spec.rb +0 -57
  41. data/spec/suites/rspec_2/integration/rspec_2_spec.rb +0 -126
  42. data/spec/suites/rspec_2/integration/test_unit_200_spec.rb +0 -57
  43. data/spec/suites/rspec_2/integration/test_unit_2_spec.rb +0 -57
  44. data/spec/suites/rspec_2/spec_helper.rb +0 -3
  45. data/spec/suites/rspec_2/support/matchers/wildcard_matcher_matchers.rb +0 -32
  46. data/spec/suites/rspec_2/support/shared_examples/space.rb +0 -13
  47. data/spec/suites/rspec_2/support/shared_examples/times_called_expectation.rb +0 -9
  48. data/spec/suites/rspec_2/unit/adapters/rr_methods/double_creators_spec.rb +0 -135
  49. data/spec/suites/rspec_2/unit/adapters/rr_methods/space_spec.rb +0 -101
  50. data/spec/suites/rspec_2/unit/adapters/rr_methods/wildcard_matchers_spec.rb +0 -69
  51. data/spec/suites/rspec_2/unit/core_ext/array_spec.rb +0 -39
  52. data/spec/suites/rspec_2/unit/core_ext/enumerable_spec.rb +0 -81
  53. data/spec/suites/rspec_2/unit/core_ext/hash_spec.rb +0 -55
  54. data/spec/suites/rspec_2/unit/core_ext/range_spec.rb +0 -41
  55. data/spec/suites/rspec_2/unit/core_ext/regexp_spec.rb +0 -41
  56. data/spec/suites/rspec_2/unit/double_definitions/child_double_definition_create_spec.rb +0 -114
  57. data/spec/suites/rspec_2/unit/double_definitions/double_definition_create_blank_slate_spec.rb +0 -93
  58. data/spec/suites/rspec_2/unit/double_definitions/double_definition_create_spec.rb +0 -446
  59. data/spec/suites/rspec_2/unit/errors/rr_error_spec.rb +0 -67
  60. data/spec/suites/rspec_2/unit/expectations/any_argument_expectation_spec.rb +0 -48
  61. data/spec/suites/rspec_2/unit/expectations/anything_argument_equality_expectation_spec.rb +0 -14
  62. data/spec/suites/rspec_2/unit/expectations/argument_equality_expectation_spec.rb +0 -135
  63. data/spec/suites/rspec_2/unit/expectations/boolean_argument_equality_expectation_spec.rb +0 -30
  64. data/spec/suites/rspec_2/unit/expectations/hash_including_argument_equality_expectation_spec.rb +0 -82
  65. data/spec/suites/rspec_2/unit/expectations/satisfy_argument_equality_expectation_spec.rb +0 -61
  66. data/spec/suites/rspec_2/unit/expectations/times_called_expectation/any_times_matcher_spec.rb +0 -22
  67. data/spec/suites/rspec_2/unit/expectations/times_called_expectation/at_least_matcher_spec.rb +0 -37
  68. data/spec/suites/rspec_2/unit/expectations/times_called_expectation/at_most_matcher_spec.rb +0 -43
  69. data/spec/suites/rspec_2/unit/expectations/times_called_expectation/integer_matcher_spec.rb +0 -58
  70. data/spec/suites/rspec_2/unit/expectations/times_called_expectation/proc_matcher_spec.rb +0 -35
  71. data/spec/suites/rspec_2/unit/expectations/times_called_expectation/range_matcher_spec.rb +0 -39
  72. data/spec/suites/rspec_2/unit/hash_with_object_id_key_spec.rb +0 -88
  73. data/spec/suites/rspec_2/unit/injections/double_injection/double_injection_spec.rb +0 -545
  74. data/spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb +0 -32
  75. data/spec/suites/rspec_2/unit/integrations/rspec/invocation_matcher_spec.rb +0 -297
  76. data/spec/suites/rspec_2/unit/integrations/rspec_spec.rb +0 -85
  77. data/spec/suites/rspec_2/unit/proc_from_block_spec.rb +0 -14
  78. data/spec/suites/rspec_2/unit/rr_spec.rb +0 -28
  79. data/spec/suites/rspec_2/unit/space_spec.rb +0 -595
  80. data/spec/suites/rspec_2/unit/spy_verification_spec.rb +0 -133
  81. data/spec/suites/rspec_2/unit/times_called_matchers/any_times_matcher_spec.rb +0 -46
  82. data/spec/suites/rspec_2/unit/times_called_matchers/at_least_matcher_spec.rb +0 -54
  83. data/spec/suites/rspec_2/unit/times_called_matchers/at_most_matcher_spec.rb +0 -69
  84. data/spec/suites/rspec_2/unit/times_called_matchers/integer_matcher_spec.rb +0 -69
  85. data/spec/suites/rspec_2/unit/times_called_matchers/proc_matcher_spec.rb +0 -54
  86. data/spec/suites/rspec_2/unit/times_called_matchers/range_matcher_spec.rb +0 -75
  87. data/spec/suites/rspec_2/unit/times_called_matchers/times_called_matcher_spec.rb +0 -117
  88. data/spec/suites/rspec_2/unit/wildcard_matchers/anything_spec.rb +0 -33
  89. data/spec/suites/rspec_2/unit/wildcard_matchers/boolean_spec.rb +0 -45
  90. data/spec/suites/rspec_2/unit/wildcard_matchers/duck_type_spec.rb +0 -64
  91. data/spec/suites/rspec_2/unit/wildcard_matchers/hash_including_spec.rb +0 -64
  92. data/spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb +0 -55
  93. data/spec/suites/rspec_2/unit/wildcard_matchers/numeric_spec.rb +0 -46
  94. data/spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb +0 -57
  95. data/spec/suites/rspec_2_rails_3/integration/minitest_4_rails_3_spec.rb +0 -66
  96. data/spec/suites/rspec_2_rails_3/integration/test_unit_200_rails_3_spec.rb +0 -66
  97. data/spec/suites/rspec_2_rails_3/integration/test_unit_2_rails_3_spec.rb +0 -66
  98. data/spec/suites/rspec_2_rails_3/spec_helper.rb +0 -3
  99. data/spec/suites/rspec_2_rails_4/integration/minitest_4_rails_4_spec.rb +0 -66
  100. data/spec/suites/rspec_2_rails_4/integration/rspec_2_rails_4_spec.rb +0 -156
  101. data/spec/suites/rspec_2_rails_4/integration/test_unit_200_rails_4_spec.rb +0 -66
  102. data/spec/suites/rspec_2_rails_4/integration/test_unit_2_rails_4_spec.rb +0 -66
  103. data/spec/suites/rspec_2_rails_4/spec_helper.rb +0 -3
  104. data/spec/suites/test_unit_1/integration/test_unit_1_test.rb +0 -10
  105. data/spec/suites/test_unit_1/test_helper.rb +0 -10
  106. data/spec/suites/test_unit_2/integration/test_unit_2_test.rb +0 -10
  107. data/spec/suites/test_unit_2/test_helper.rb +0 -6
  108. data/spec/suites/test_unit_200/integration/test_unit_200_test.rb +0 -10
  109. data/spec/suites/test_unit_200/test_helper.rb +0 -6
  110. data/spec/suites/test_unit_200_rails_3/integration/test_unit_200_rails_3_test.rb +0 -10
  111. data/spec/suites/test_unit_200_rails_3/test_helper.rb +0 -7
  112. data/spec/suites/test_unit_200_rails_4/integration/test_unit_200_rails_4_test.rb +0 -10
  113. data/spec/suites/test_unit_200_rails_4/test_helper.rb +0 -7
  114. data/spec/suites/test_unit_2_rails_2/integration/test_unit_2_rails_2_test.rb +0 -10
  115. data/spec/suites/test_unit_2_rails_2/test_helper.rb +0 -7
  116. data/spec/suites/test_unit_2_rails_3/integration/test_unit_2_rails_3_test.rb +0 -10
  117. data/spec/suites/test_unit_2_rails_3/test_helper.rb +0 -7
  118. data/spec/suites/test_unit_2_rails_4/integration/test_unit_2_rails_4_test.rb +0 -10
  119. data/spec/suites/test_unit_2_rails_4/test_helper.rb +0 -7
@@ -1,160 +0,0 @@
1
- require 'rubygems'
2
- require 'session'
3
- require 'tempfile'
4
- require 'appraisal'
5
-
6
- module AdapterIntegrationTests
7
- ROOT_DIR = File.expand_path('../../../..', __FILE__)
8
- LIB_DIR = File.join(ROOT_DIR, 'lib')
9
- TEMP_DIR = '/tmp/rr_integration_tests'
10
-
11
- def create_link(filename)
12
- FileUtils.ln_s(File.join(ROOT_DIR, filename), File.join(TEMP_DIR, filename))
13
- end
14
-
15
- def debug?
16
- RR.debug?
17
- end
18
-
19
- def ruby_18?
20
- RUBY_VERSION =~ /^1\.8/
21
- end
22
-
23
- def run_fixture_tests(content)
24
- fixture_path = File.join(TEMP_DIR, 'rr_test_fixture_spec.rb')
25
- FileUtils.rm_f(fixture_path)
26
- f = File.open(fixture_path, 'w')
27
- puts content if debug?
28
- f.write(content)
29
- f.close
30
- bash = Session::Bash.new
31
- # Bundler will set RUBYOPT to "-I <path to bundler> -r bundler/setup".
32
- # This is unfortunate as it causes Bundler to be loaded before we
33
- # load Bundler in RR::Test.setup_test_suite, thereby rendering our
34
- # second Bundler.setup a no-op.
35
- command = "env RUBYOPT='' ruby -I #{LIB_DIR} #{f.path} 2>&1"
36
- puts command if debug?
37
- stdout, _ = bash.execute(command)
38
- exit_status = bash.exit_status
39
- success = !!(exit_status == 0 || stdout =~ /Finished/)
40
- if debug? or !success
41
- puts stdout
42
- end
43
- success.should be_true
44
- stdout
45
- ensure
46
- FileUtils.rm_f(fixture_path) if fixture_path
47
- end
48
-
49
- def test_helper_path
50
- File.join(ROOT_DIR, 'spec/global_helper.rb')
51
- end
52
-
53
- def full_bootstrap(opts={})
54
- str = ""
55
- str << <<-EOT
56
- require 'fileutils'
57
- temp_dir = '#{TEMP_DIR}'
58
- Dir.chdir(temp_dir)
59
- require '#{test_helper_path}'
60
- RR::Test.setup_test_suite('#{adapter_name}')
61
- EOT
62
- str << opts[:before_require_rr] if opts[:before_require_rr]
63
- str << require_rr if opts[:include_rr_before_test_framework]
64
- str << require_test_framework(opts)
65
- str << require_rr unless opts[:include_rr_before_test_framework]
66
- str
67
- end
68
-
69
- def require_rr
70
- "require 'rr'\n"
71
- end
72
-
73
- def before_require_test_framework
74
- ""
75
- end
76
-
77
- def require_test_framework(opts={})
78
- parts = [
79
- before_require_test_framework,
80
- opts[:before_require_test_framework] || "",
81
- ]
82
- paths = test_framework_path
83
- paths = [paths] unless paths.is_a?(Array)
84
- paths.each do |path|
85
- parts << "require '#{path}'"
86
- end
87
- parts << after_require_test_framework
88
- parts.join("\n")
89
- end
90
-
91
- def after_require_test_framework
92
- ""
93
- end
94
-
95
- def with_bootstrap(*args)
96
- opts = args.last.is_a?(Hash) ? args.pop : {}
97
- str = args.first || ""
98
- [full_bootstrap(opts), str].join("\n")
99
- end
100
-
101
- def all_tests_should_pass(output)
102
- if output =~ /(\d+) failure/
103
- $1.should be == '0'
104
- end
105
- if output =~ /(\d+) error/
106
- $1.should be == '0'
107
- end
108
- end
109
-
110
- def self.included(base)
111
- base.class_eval do
112
- before :all do
113
- FileUtils.rm_rf(TEMP_DIR)
114
- FileUtils.mkdir(TEMP_DIR)
115
- create_link('Gemfile')
116
- create_link('Appraisals')
117
- create_link('gemfiles')
118
- end
119
-
120
- after :all do
121
- FileUtils.rm_rf(TEMP_DIR)
122
- end
123
-
124
- specify "when RR raises an error it raises a failure not an exception" do
125
- output = run_fixture_tests(error_test)
126
- output.should match /1 failure/
127
- end
128
-
129
- if method_defined?(:include_adapter_test)
130
- specify "it is still possible to include the adapter into the test framework manually" do
131
- output = run_fixture_tests(include_adapter_test)
132
- all_tests_should_pass(output)
133
- end
134
- end
135
-
136
- if method_defined?(:include_adapter_where_rr_included_before_test_framework_test)
137
- specify "it is still possible to include the adapter into the test framework manually when RR is included before the test framework" do
138
- output = run_fixture_tests(include_adapter_where_rr_included_before_test_framework_test)
139
- all_tests_should_pass(output)
140
- end
141
- end
142
-
143
- # issue #29
144
- specify "loading Cucumber doesn't mess up RR's autohook mechanism" do
145
- FileUtils.mkdir(File.join(TEMP_DIR, 'features'))
146
- loading_cucumber_test = <<-EOT
147
- require 'fileutils'
148
- temp_dir = '#{TEMP_DIR}'
149
- Dir.chdir(temp_dir)
150
- require '#{test_helper_path}'
151
- RR::Test.setup_test_suite('#{adapter_name}')
152
- # This is what gets loaded within the `cucumber` executable
153
- require 'cucumber/rspec/disable_option_parser'
154
- require 'rr'
155
- EOT
156
- run_fixture_tests(loading_cucumber_test)
157
- end
158
- end
159
- end
160
- end
@@ -1,43 +0,0 @@
1
- require 'set'
2
-
3
- module AdapterTests
4
- def test_the_correct_adapters_are_loaded
5
- assert_equal Set.new(applicable_adapter_names), Set.new(RR.loaded_adapter_names)
6
- end
7
-
8
- def test_using_a_mock
9
- subject = Object.new
10
- mock(subject).foobar(1, 2) { :baz }
11
- assert_equal :baz, subject.foobar(1, 2)
12
- end
13
-
14
- def test_using_a_stub
15
- subject = Object.new
16
- stub(subject).foobar { :baz }
17
- assert_equal :baz, subject.foobar("any", "thing")
18
- end
19
-
20
- def test_using_a_mock_proxy
21
- subject = Object.new
22
- def subject.foobar; :baz; end
23
-
24
- mock.proxy(subject).foobar
25
- assert_equal :baz, subject.foobar
26
- end
27
-
28
- def test_using_a_stub_proxy
29
- subject = Object.new
30
- def subject.foobar; :baz; end
31
-
32
- stub.proxy(subject).foobar
33
- assert_equal :baz, subject.foobar
34
- end
35
-
36
- def test_times_called_verification
37
- subject = Object.new
38
- mock(subject).foobar(1, 2) { :baz }
39
- assert_raise RR::Errors.error_class(:TimesCalledError) do
40
- RR.verify
41
- end
42
- end
43
- end
@@ -1,106 +0,0 @@
1
- $is_java = (RUBY_PLATFORM == 'java')
2
- if $is_java
3
- require 'active_record'
4
- require 'arjdbc'
5
- require 'arjdbc/sqlite3'
6
- else
7
- require 'sqlite3'
8
- end
9
-
10
- module RailsIntegrationTests
11
- def sqlite_adapter
12
- $is_java ? 'jdbcsqlite3' : 'sqlite3'
13
- end
14
-
15
- def sqlite_db_file_path
16
- '/tmp/rr-test-db.sqlite3'
17
- end
18
-
19
- def rails_test_helper
20
- ruby_18? ? 'test_help' : 'rails/test_help'
21
- end
22
-
23
- def with_active_record_bootstrap(str)
24
- with_bootstrap str, :before_require_test_framework => <<-EOT
25
- require 'active_record'
26
-
27
- # This is necessary to turn on transactional tests, for some reason
28
- config = ActiveRecord::Base.configurations[:foo] = {
29
- :adapter => '#{sqlite_adapter}',
30
- :database => '#{sqlite_db_file_path}'
31
- }
32
- ActiveRecord::Base.establish_connection(config)
33
-
34
- require '#{rails_test_helper}'
35
-
36
- ActiveRecord::Base.logger = Logger.new(File.open('/tmp/tests.log', 'a+'))
37
- class Person < ActiveRecord::Base; end
38
- EOT
39
- end
40
-
41
- def database_properly_rolled_back_test
42
- with_active_record_bootstrap <<-EOT
43
- class FooTest < ActiveRecord::TestCase
44
- def test_one
45
- Person.create!(:name => 'Joe Blow')
46
- object = Object.new
47
- mock(object).foo
48
- end
49
- end
50
- EOT
51
- end
52
-
53
- def activerecord_teardown_still_works_test
54
- with_active_record_bootstrap <<-EOT
55
- class FooTest < ActiveRecord::TestCase
56
- teardown do
57
- raise 'hell'
58
- end
59
-
60
- def test_one
61
- # whatever
62
- end
63
- end
64
- EOT
65
- end
66
-
67
- def self.included(base)
68
- base.class_eval do
69
- specify "the database is properly rolled back after an RR error" do
70
- setup_database
71
-
72
- count = ActiveRecord::Base.connection.select_value('SELECT COUNT(*) from people')
73
- count.to_i.should be == 0
74
-
75
- run_fixture_tests(database_properly_rolled_back_test)
76
-
77
- count = ActiveRecord::Base.connection.select_value('SELECT COUNT(*) from people')
78
- count.to_i.should be == 0
79
- end
80
-
81
- specify "throwing an error in teardown doesn't mess things up" do
82
- setup_database
83
- run_fixture_tests(activerecord_teardown_still_works_test)
84
- end
85
-
86
- def setup_database
87
- require 'active_record'
88
- FileUtils.rm_f(sqlite_db_file_path)
89
- ActiveRecord::Base.establish_connection(
90
- :adapter => sqlite_adapter,
91
- :database => sqlite_db_file_path
92
- )
93
- unless debug?
94
- old_stdout = $stdout
95
- $stdout = File.open('/dev/null', 'w')
96
- end
97
- ActiveRecord::Migration.create_table :people do |t|
98
- t.string :name
99
- end
100
- unless debug?
101
- $stdout = old_stdout
102
- end
103
- end
104
- end
105
- end
106
- end
@@ -1,21 +0,0 @@
1
- require File.expand_path('../adapter_tests', __FILE__)
2
-
3
- module TestUnitTests
4
- def self.included(base)
5
- base.class_eval { include AdapterTests }
6
- end
7
-
8
- def test_using_assert_received
9
- subject = Object.new
10
- stub(subject).foobar(1, 2)
11
- subject.foobar(1, 2)
12
- assert_received(subject) {|s| s.foobar(1, 2) }
13
-
14
- error_class = RR::Errors.error_class(
15
- RR::Errors::SpyVerificationErrors::InvocationCountError
16
- )
17
- assert_raise(error_class) do
18
- assert_received(subject) {|s| s.foobar(1, 2, 3) }
19
- end
20
- end
21
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../../test_helper', __FILE__)
2
- require File.expand_path('../../../common/test_unit_tests', __FILE__)
3
-
4
- class MiniTestIntegrationTest < Minitest::Test
5
- # Test::Unit compatibility
6
- alias_method :assert_raise, :assert_raises
7
-
8
- def applicable_adapter_names
9
- [:Minitest]
10
- end
11
-
12
- include TestUnitTests
13
- end
@@ -1,7 +0,0 @@
1
- require File.expand_path('../../../global_helper', __FILE__)
2
- RR::Test.setup_test_suite(:minitest)
3
-
4
- require 'minitest/autorun'
5
-
6
- require 'rr'
7
-
@@ -1,13 +0,0 @@
1
- require File.expand_path('../../test_helper', __FILE__)
2
- require File.expand_path('../../../common/test_unit_tests', __FILE__)
3
-
4
- class MiniTestIntegrationTest < MiniTest::Unit::TestCase
5
- # Test::Unit compatibility
6
- alias_method :assert_raise, :assert_raises
7
-
8
- def applicable_adapter_names
9
- [:MiniTest4]
10
- end
11
-
12
- include TestUnitTests
13
- end
@@ -1,7 +0,0 @@
1
- require File.expand_path('../../../global_helper', __FILE__)
2
- RR::Test.setup_test_suite(:minitest_4)
3
-
4
- require 'minitest/autorun'
5
-
6
- require 'rr'
7
-
@@ -1,24 +0,0 @@
1
- require 'spec/autorun'
2
-
3
- require 'rr'
4
-
5
- module ExampleMethods
6
- def eigen(object)
7
- class << object; self; end
8
- end
9
- end
10
-
11
- module ExampleGroupMethods
12
- def macro(name, &implementation)
13
- (class << self; self; end).class_eval do
14
- define_method(name, &implementation)
15
- end
16
- end
17
- end
18
-
19
- Spec::Runner.configure do |c|
20
- c.include ExampleMethods
21
- c.extend ExampleGroupMethods
22
- end
23
-
24
- Dir[ File.expand_path('../shared/*.rb', __FILE__) ].each {|fn| require fn }
@@ -1,77 +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
-
5
- describe 'Integration with RSpec 1' do
6
- def assert_equal(expected, actual)
7
- actual.should be == expected
8
- end
9
-
10
- def assert_raise(error, message=nil, &block)
11
- expect(&block).to raise_error(error, message)
12
- end
13
-
14
- def adapter_name
15
- 'rspec_1'
16
- end
17
-
18
- def applicable_adapter_names
19
- [:RSpec1]
20
- end
21
-
22
- def test_framework_path
23
- 'spec/autorun'
24
- end
25
-
26
- def error_test
27
- with_bootstrap <<-EOT
28
- describe 'A test' do
29
- it 'is a test' do
30
- object = Object.new
31
- mock(object).foo
32
- end
33
- end
34
- EOT
35
- end
36
-
37
- def include_adapter_test
38
- with_bootstrap <<-EOT
39
- Spec::Runner.configure do |c|
40
- c.mock_with :rr
41
- end
42
-
43
- describe 'A test' do
44
- it 'is a test' do
45
- object = Object.new
46
- mock(object).foo
47
- object.foo
48
- end
49
- end
50
- EOT
51
- end
52
-
53
- def include_adapter_where_rr_included_before_test_framework_test
54
- with_bootstrap <<-EOT, :include_rr_before_test_framework => true
55
- Spec::Runner.configure do |c|
56
- c.mock_with :rr
57
- end
58
-
59
- describe 'A test' do
60
- it 'is a test' do
61
- object = Object.new
62
- mock(object).foo
63
- object.foo
64
- end
65
- end
66
- EOT
67
- end
68
-
69
- include AdapterTests
70
- instance_methods.each do |method_name|
71
- if method_name =~ /^test_(.+)$/
72
- it(method_name) { __send__(method_name) }
73
- end
74
- end
75
-
76
- include AdapterIntegrationTests
77
- end