rr 1.0.4 → 1.0.5.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +15 -0
  2. data/CHANGES.md +376 -0
  3. data/Gemfile +7 -10
  4. data/README.md +822 -0
  5. data/Rakefile +24 -78
  6. data/VERSION +1 -0
  7. data/lib/rr.rb +3 -0
  8. data/lib/rr/adapters/minitest.rb +6 -0
  9. data/lib/rr/adapters/rr_methods.rb +6 -10
  10. data/lib/rr/adapters/rspec.rb +3 -0
  11. data/lib/rr/adapters/rspec2.rb +30 -0
  12. data/lib/rr/adapters/test_unit.rb +2 -0
  13. data/lib/rr/double.rb +3 -2
  14. data/lib/rr/double_definitions/child_double_definition_create.rb +3 -2
  15. data/lib/rr/double_definitions/double_definition.rb +15 -13
  16. data/lib/rr/double_definitions/double_definition_create.rb +9 -5
  17. data/lib/rr/double_definitions/double_injections/any_instance_of.rb +3 -2
  18. data/lib/rr/double_definitions/strategies/strategy.rb +5 -4
  19. data/lib/rr/double_definitions/strategies/strategy_methods.rb +6 -8
  20. data/lib/rr/double_definitions/strategies/verification/mock.rb +3 -3
  21. data/lib/rr/double_matches.rb +2 -1
  22. data/lib/rr/expectations/argument_equality_expectation.rb +2 -2
  23. data/lib/rr/expectations/times_called_expectation.rb +2 -2
  24. data/lib/rr/injections/double_injection.rb +12 -11
  25. data/lib/rr/injections/injection.rb +2 -2
  26. data/lib/rr/injections/method_missing_injection.rb +21 -7
  27. data/lib/rr/injections/singleton_method_added_injection.rb +3 -1
  28. data/lib/rr/method_dispatches/base_method_dispatch.rb +1 -1
  29. data/lib/rr/method_dispatches/method_dispatch.rb +2 -1
  30. data/lib/rr/method_dispatches/method_missing_dispatch.rb +2 -1
  31. data/lib/rr/proc_from_block.rb +8 -4
  32. data/lib/rr/space.rb +3 -2
  33. data/lib/rr/times_called_matchers/times_called_matcher.rb +2 -2
  34. data/lib/rr/version.rb +5 -0
  35. data/lib/rr/wildcard_matchers/boolean.rb +2 -2
  36. data/spec/runner.rb +41 -0
  37. metadata +45 -133
  38. data/.gitignore +0 -10
  39. data/.runrc +0 -3
  40. data/.rvmrc +0 -2
  41. data/CHANGES +0 -266
  42. data/Gemfile.lock +0 -31
  43. data/README.rdoc +0 -392
  44. data/benchmarks/rr_benchmark.rb +0 -32
  45. data/benchmarks/rspec_benchmark.rb +0 -14
  46. data/doc/0.6.0.release.markdown +0 -81
  47. data/doc/todo.txt +0 -0
  48. data/introducting_rr.txt +0 -206
  49. data/rr.gemspec +0 -37
  50. data/spec/api/any_instance_of/all_instances_of_spec.rb +0 -12
  51. data/spec/api/any_instance_of/any_instance_of_spec.rb +0 -47
  52. data/spec/api/any_instance_of/instance_of_spec.rb +0 -12
  53. data/spec/api/dont_allow/dont_allow_after_stub_spec.rb +0 -14
  54. data/spec/api/mock/mock_spec.rb +0 -193
  55. data/spec/api/proxy/proxy_spec.rb +0 -86
  56. data/spec/api/spy/spy_spec.rb +0 -49
  57. data/spec/api/strong/strong_spec.rb +0 -87
  58. data/spec/api/stub/stub_spec.rb +0 -152
  59. data/spec/core_spec_suite.rb +0 -19
  60. data/spec/environment_fixture_setup.rb +0 -8
  61. data/spec/minitest_spec_suite.rb +0 -21
  62. data/spec/proc_from_block_spec.rb +0 -14
  63. data/spec/rr/adapters/rr_methods_argument_matcher_spec.rb +0 -67
  64. data/spec/rr/adapters/rr_methods_creator_spec.rb +0 -137
  65. data/spec/rr/adapters/rr_methods_space_spec.rb +0 -98
  66. data/spec/rr/adapters/rr_methods_spec_helper.rb +0 -11
  67. data/spec/rr/adapters/rr_methods_times_matcher_spec.rb +0 -13
  68. data/spec/rr/double_definitions/child_double_definition_creator_spec.rb +0 -112
  69. data/spec/rr/double_definitions/double_definition_create_blank_slate_spec.rb +0 -91
  70. data/spec/rr/double_definitions/double_definition_create_spec.rb +0 -443
  71. data/spec/rr/double_injection/double_injection_spec.rb +0 -546
  72. data/spec/rr/double_injection/double_injection_verify_spec.rb +0 -29
  73. data/spec/rr/errors/rr_error_spec.rb +0 -67
  74. data/spec/rr/expectations/any_argument_expectation_spec.rb +0 -47
  75. data/spec/rr/expectations/anything_argument_equality_expectation_spec.rb +0 -14
  76. data/spec/rr/expectations/argument_equality_expectation_spec.rb +0 -135
  77. data/spec/rr/expectations/boolean_argument_equality_expectation_spec.rb +0 -34
  78. data/spec/rr/expectations/hash_including_argument_equality_expectation_spec.rb +0 -82
  79. data/spec/rr/expectations/hash_including_spec.rb +0 -17
  80. data/spec/rr/expectations/satisfy_argument_equality_expectation_spec.rb +0 -59
  81. data/spec/rr/expectations/satisfy_spec.rb +0 -14
  82. data/spec/rr/expectations/times_called_expectation/times_called_expectation_any_times_spec.rb +0 -22
  83. data/spec/rr/expectations/times_called_expectation/times_called_expectation_at_least_spec.rb +0 -37
  84. data/spec/rr/expectations/times_called_expectation/times_called_expectation_at_most_spec.rb +0 -43
  85. data/spec/rr/expectations/times_called_expectation/times_called_expectation_helper.rb +0 -15
  86. data/spec/rr/expectations/times_called_expectation/times_called_expectation_integer_spec.rb +0 -58
  87. data/spec/rr/expectations/times_called_expectation/times_called_expectation_proc_spec.rb +0 -35
  88. data/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb +0 -39
  89. data/spec/rr/minitest/minitest_integration_test.rb +0 -59
  90. data/spec/rr/minitest/test_helper.rb +0 -7
  91. data/spec/rr/rspec/invocation_matcher_spec.rb +0 -279
  92. data/spec/rr/rspec/rspec_adapter_spec.rb +0 -63
  93. data/spec/rr/rspec/rspec_backtrace_tweaking_spec.rb +0 -31
  94. data/spec/rr/rspec/rspec_backtrace_tweaking_spec_fixture.rb +0 -11
  95. data/spec/rr/rspec/rspec_usage_spec.rb +0 -86
  96. data/spec/rr/space/hash_with_object_id_key_spec.rb +0 -88
  97. data/spec/rr/space/space_spec.rb +0 -596
  98. data/spec/rr/test_unit/test_helper.rb +0 -7
  99. data/spec/rr/test_unit/test_unit_backtrace_test.rb +0 -36
  100. data/spec/rr/test_unit/test_unit_integration_test.rb +0 -59
  101. data/spec/rr/times_called_matchers/any_times_matcher_spec.rb +0 -47
  102. data/spec/rr/times_called_matchers/at_least_matcher_spec.rb +0 -55
  103. data/spec/rr/times_called_matchers/at_most_matcher_spec.rb +0 -70
  104. data/spec/rr/times_called_matchers/integer_matcher_spec.rb +0 -70
  105. data/spec/rr/times_called_matchers/proc_matcher_spec.rb +0 -55
  106. data/spec/rr/times_called_matchers/range_matcher_spec.rb +0 -76
  107. data/spec/rr/times_called_matchers/times_called_matcher_spec.rb +0 -118
  108. data/spec/rr/wildcard_matchers/anything_spec.rb +0 -24
  109. data/spec/rr/wildcard_matchers/boolean_spec.rb +0 -36
  110. data/spec/rr/wildcard_matchers/duck_type_spec.rb +0 -52
  111. data/spec/rr/wildcard_matchers/is_a_spec.rb +0 -32
  112. data/spec/rr/wildcard_matchers/numeric_spec.rb +0 -32
  113. data/spec/rr/wildcard_matchers/range_spec.rb +0 -35
  114. data/spec/rr/wildcard_matchers/regexp_spec.rb +0 -43
  115. data/spec/rr_spec.rb +0 -28
  116. data/spec/rspec_spec_suite.rb +0 -17
  117. data/spec/spec.opts +0 -10
  118. data/spec/spec_helper.rb +0 -41
  119. data/spec/spec_suite.rb +0 -54
  120. data/spec/spy_verification_spec.rb +0 -129
  121. data/spec/test_unit_spec_suite.rb +0 -21
data/Rakefile CHANGED
@@ -1,88 +1,34 @@
1
- require "rake"
2
- require 'rake/contrib/rubyforgepublisher'
3
- require 'rake/clean'
4
- require 'rake/testtask'
5
- require 'rake/rdoctask'
1
+ require 'rubygems'
2
+ require 'rake'
6
3
 
7
- desc "Runs the Rspec suite"
8
- task(:default) do
9
- run_suite
10
- end
11
-
12
- desc "Runs the Rspec suite"
13
- task(:spec) do
14
- run_suite
15
- end
4
+ require File.expand_path('../spec/runner', __FILE__)
16
5
 
17
- def run_suite
18
- dir = File.dirname(__FILE__)
19
- system("ruby #{dir}/spec/spec_suite.rb") || raise("Spec Suite failed")
20
- end
6
+ task :default => :spec
21
7
 
22
- begin
23
- require 'jeweler'
24
- Jeweler::Tasks.new do |s|
25
- s.name = "rr"
26
- s.summary = "RR (Double Ruby) is a double framework that features a rich " <<
27
- "selection of double techniques and a terse syntax. " <<
28
- "http://xunitpatterns.com/Test%20Double.html"
29
- s.email = "brian@pivotallabs.com"
30
- s.homepage = "http://pivotallabs.com"
31
- s.description = "RR (Double Ruby) is a double framework that features a rich " <<
32
- "selection of double techniques and a terse syntax. " <<
33
- "http://xunitpatterns.com/Test%20Double.html"
34
- s.authors = ["Brian Takita"]
35
- s.files = FileList[
36
- '[A-Z]*',
37
- '*.rb',
38
- 'lib/**/*.rb',
39
- 'spec/**/*.rb'
40
- ].to_a
41
- s.test_files = Dir.glob('spec/*_spec.rb')
42
- s.has_rdoc = true
43
- s.extra_rdoc_files = [ "README.rdoc", "CHANGES" ]
44
- s.rdoc_options = ["--main", "README.rdoc", "--inline-source", "--line-numbers"]
45
- s.rubyforge_project = "pivotalrb"
8
+ desc "Runs all of the tests"
9
+ task :spec do
10
+ ARGV.clear
11
+ unless SuitesRunner.new.run
12
+ raise "Spec Suite failed"
46
13
  end
47
- rescue LoadError
48
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
49
14
  end
50
- RUBYFORGE_PACKAGE_NAME = "rr (Double Ruby)"
51
- # The package was renamed from "rr (Double R)" to "rr (Double Ruby)".
52
- # When this was last run, the script did not work for the new name but it did work for the old name.
53
- # Perhaps more time was needed for the name change to propagate?
54
- #RUBYFORGE_PACKAGE_NAME = "rr (Double R)"
55
-
56
- # This is hacked to get around the 3 character limitation for package names on Rubyforge.
57
- # http://rubyforge.org/tracker/index.php?func=detail&aid=27026&group_id=5&atid=102
58
- class Jeweler
59
- module Commands
60
- class ReleaseToRubyforge
61
- def run
62
- raise NoRubyForgeProjectInGemspecError unless @gemspec.rubyforge_project
63
15
 
64
- @rubyforge.configure rescue nil
65
-
66
- output.puts 'Logging in rubyforge'
67
- @rubyforge.login
68
-
69
- @rubyforge.userconfig['release_notes'] = @gemspec.description if @gemspec.description
70
- @rubyforge.userconfig['preformatted'] = true
71
-
72
- output.puts "Releasing #{@gemspec.name}-#{@version} to #{@gemspec.rubyforge_project}"
73
- begin
74
- @rubyforge.add_release(@gemspec.rubyforge_project, RUBYFORGE_PACKAGE_NAME, @version.to_s, @gemspec_helper.gem_path)
75
- rescue StandardError => e
76
- case e.message
77
- when /no <group_id> configured for <#{Regexp.escape @gemspec.rubyforge_project}>/
78
- raise RubyForgeProjectNotConfiguredError, @gemspec.rubyforge_project
79
- when /no <package_id> configured for <#{Regexp.escape @gemspec.name}>/i
80
- raise MissingRubyForgePackageError, @gemspec.name
81
- else
82
- raise
83
- end
84
- end
16
+ namespace :spec do
17
+ SuitesRunner::TEST_SUITES.each do |path, class_fragment, desc|
18
+ desc "Runs all of the #{desc} tests"
19
+ task path do
20
+ ARGV.clear
21
+ require File.expand_path("../spec/suites/#{path}/runner.rb", __FILE__)
22
+ unless Object.const_get("#{class_fragment}SuiteRunner").new.run
23
+ raise "#{desc} Suite failed"
85
24
  end
86
25
  end
87
26
  end
88
27
  end
28
+
29
+ begin
30
+ require 'bundler'
31
+ require 'bundler/gem_tasks'
32
+ rescue LoadError
33
+ puts "Bundler isn't installed. Run `gem install bundler` to get it."
34
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.5.rc1
data/lib/rr.rb CHANGED
@@ -83,9 +83,12 @@ require "#{dir}/rr/spy_verification_proxy"
83
83
  require "#{dir}/rr/spy_verification"
84
84
 
85
85
  require "#{dir}/rr/adapters/rspec"
86
+ require "#{dir}/rr/adapters/rspec2"
86
87
  require "#{dir}/rr/adapters/test_unit"
87
88
  require "#{dir}/rr/adapters/minitest"
88
89
 
90
+ require "#{dir}/rr/version"
91
+
89
92
  module RR
90
93
  class << self
91
94
  include Adapters::RRMethods
@@ -2,6 +2,7 @@ module RR
2
2
  module Adapters
3
3
  module MiniTest
4
4
  include RRMethods
5
+
5
6
  def self.included(mod)
6
7
  RR.trim_backtrace = true
7
8
  mod.class_eval do
@@ -16,6 +17,11 @@ module RR
16
17
  alias_method :teardown_without_rr, :teardown
17
18
  def teardown_with_rr
18
19
  RR.verify
20
+ rescue RR::Errors::RRError => rr_error
21
+ assertion = ::MiniTest::Assertion.new(rr_error.message)
22
+ assertion.set_backtrace(rr_error.backtrace)
23
+ raise assertion
24
+ ensure
19
25
  teardown_without_rr
20
26
  end
21
27
  alias_method :teardown, :teardown_with_rr
@@ -2,6 +2,7 @@ module RR
2
2
  module Adapters
3
3
  module RRMethods
4
4
  include ::RR::DoubleDefinitions::Strategies::StrategyMethods
5
+
5
6
  def mock(subject=DoubleDefinitions::DoubleDefinitionCreate::NO_SUBJECT, method_name=nil, &definition_eval_block)
6
7
  double_definition_create = DoubleDefinitions::DoubleDefinitionCreate.new
7
8
  double_definition_create.mock(subject, method_name, &definition_eval_block)
@@ -31,8 +32,10 @@ module RR
31
32
  double_definition_create = DoubleDefinitions::DoubleDefinitionCreate.new
32
33
  double_definition_create.instance_of(subject, method_name, &definition_eval_block)
33
34
  end
34
- alias_method :any_instance_of, :instance_of
35
- alias_method :all_instances_of, :instance_of
35
+
36
+ def any_instance_of(*args, &block)
37
+ RR::DoubleDefinitions::DoubleInjections::AnyInstanceOf.call(*args, &block)
38
+ end
36
39
 
37
40
  # Verifies all the DoubleInjection objects have met their
38
41
  # TimesCalledExpectations.
@@ -127,19 +130,12 @@ module RR
127
130
  RR::SpyVerificationProxy.new(subject)
128
131
  end
129
132
 
130
- def new_instance_of(*args, &block)
131
- RR::DoubleDefinitions::DoubleInjections::NewInstanceOf.call(*args, &block)
132
- end
133
-
134
- def any_instance_of(*args, &block)
135
- RR::DoubleDefinitions::DoubleInjections::AnyInstanceOf.call(*args, &block)
136
- end
137
-
138
133
  instance_methods.each do |name|
139
134
  alias_method "rr_#{name}", name
140
135
  end
141
136
  end
142
137
  end
138
+
143
139
  module Extensions
144
140
  InstanceMethods = Adapters::RRMethods
145
141
  end
@@ -9,12 +9,15 @@ module RR
9
9
  end
10
10
 
11
11
  include RRMethods
12
+
12
13
  def setup_mocks_for_rspec
13
14
  RR.reset
14
15
  end
16
+
15
17
  def verify_mocks_for_rspec
16
18
  RR.verify
17
19
  end
20
+
18
21
  def teardown_mocks_for_rspec
19
22
  RR.reset
20
23
  end
@@ -0,0 +1,30 @@
1
+ module RR
2
+ module Adapters
3
+ module RSpec2
4
+ def self.included(mod)
5
+ patterns = RSpec.configuration.backtrace_clean_patterns
6
+ unless patterns.include?(RR::Errors::BACKTRACE_IDENTIFIER)
7
+ patterns.push(RR::Errors::BACKTRACE_IDENTIFIER)
8
+ end
9
+ end
10
+
11
+ include RRMethods
12
+
13
+ def setup_mocks_for_rspec
14
+ RR.reset
15
+ end
16
+
17
+ def verify_mocks_for_rspec
18
+ RR.verify
19
+ end
20
+
21
+ def teardown_mocks_for_rspec
22
+ RR.reset
23
+ end
24
+
25
+ def have_received(method = nil)
26
+ RR::Adapters::Rspec::InvocationMatcher.new(method)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -2,8 +2,10 @@ module RR
2
2
  module Adapters
3
3
  module TestUnit
4
4
  include RRMethods
5
+
5
6
  def self.included(mod)
6
7
  RR.trim_backtrace = true
8
+
7
9
  mod.class_eval do
8
10
  unless instance_methods.detect {|method_name| method_name.to_sym == :setup_with_rr}
9
11
  alias_method :setup_without_rr, :setup
data/lib/rr/double.rb CHANGED
@@ -17,6 +17,7 @@ module RR
17
17
  end)
18
18
 
19
19
  attr_reader :times_called, :double_injection, :definition, :times_called_expectation
20
+
20
21
  include Space::Reader
21
22
 
22
23
  def initialize(double_injection, definition)
@@ -94,7 +95,7 @@ module RR
94
95
  definition.implementation_is_original_method?
95
96
  end
96
97
 
97
- protected
98
+ protected
98
99
  def ordered?
99
100
  definition.ordered?
100
101
  end
@@ -151,4 +152,4 @@ module RR
151
152
  definition.argument_expectation
152
153
  end
153
154
  end
154
- end
155
+ end
@@ -2,6 +2,7 @@ module RR
2
2
  module DoubleDefinitions
3
3
  class ChildDoubleDefinitionCreate < DoubleDefinitionCreate # :nodoc
4
4
  attr_reader :parent_double_definition
5
+
5
6
  def initialize(parent_double_definition)
6
7
  @parent_double_definition = parent_double_definition
7
8
  super()
@@ -15,11 +16,11 @@ module RR
15
16
  raise NoMethodError
16
17
  end
17
18
 
18
- protected
19
+ protected
19
20
  def add_strategy(subject, method_name, definition_eval_block, &block)
20
21
  super do
21
22
  block.call
22
- parent_double_definition.implemented_by(lambda {|*args|subject})
23
+ parent_double_definition.implemented_by(lambda {|*args| subject })
23
24
  end
24
25
  end
25
26
  end
@@ -2,6 +2,7 @@ module RR
2
2
  module DoubleDefinitions
3
3
  class DoubleDefinition #:nodoc:
4
4
  ORIGINAL_METHOD = Object.new
5
+
5
6
  attr_accessor(
6
7
  :argument_expectation,
7
8
  :times_matcher,
@@ -25,7 +26,7 @@ module RR
25
26
  @verbose = false
26
27
  @verify_method_signature = false
27
28
  end
28
-
29
+
29
30
  def subject
30
31
  double_definition_create.subject
31
32
  end
@@ -33,14 +34,14 @@ module RR
33
34
  def root_subject
34
35
  double_definition_create.root_subject
35
36
  end
36
-
37
+
37
38
  module ArgumentDefinitionConstructionMethods
38
39
  # Double#with sets the expectation that the Double will receive
39
40
  # the passed in arguments.
40
41
  #
41
42
  # Passing in a block sets the return value.
42
43
  #
43
- # mock(subject).method_name.with(1, 2) {:return_value}
44
+ # mock(subject).method_name.with(1, 2) {:return_value}
44
45
  def with(*args, &return_value_block)
45
46
  @argument_expectation = Expectations::ArgumentEqualityExpectation.new(*args)
46
47
  install_method_callback return_value_block
@@ -69,7 +70,7 @@ module RR
69
70
  @argument_expectation = Expectations::ArgumentEqualityExpectation.new()
70
71
  install_method_callback return_value_block
71
72
  self
72
- end
73
+ end
73
74
  end
74
75
  include ArgumentDefinitionConstructionMethods
75
76
 
@@ -102,7 +103,7 @@ module RR
102
103
  #
103
104
  # Passing in a block sets the return value.
104
105
  #
105
- # mock(subject).method_name.twice {:return_value}
106
+ # mock(subject).method_name.twice {:return_value}
106
107
  def twice(&return_value_block)
107
108
  @times_matcher = TimesCalledMatchers::IntegerMatcher.new(2)
108
109
  install_method_callback return_value_block
@@ -128,7 +129,7 @@ module RR
128
129
  #
129
130
  # Passing in a block sets the return value.
130
131
  #
131
- # mock(subject).method_name.at_most(4) {:return_value}
132
+ # mock(subject).method_name.at_most(4) {:return_value}
132
133
  def at_most(number, &return_value_block)
133
134
  @times_matcher = TimesCalledMatchers::AtMostMatcher.new(number)
134
135
  install_method_callback return_value_block
@@ -141,7 +142,7 @@ module RR
141
142
  #
142
143
  # Passing in a block sets the return value.
143
144
  #
144
- # mock(subject).method_name.any_number_of_times
145
+ # mock(subject).method_name.any_number_of_times
145
146
  def any_number_of_times(&return_value_block)
146
147
  @times_matcher = TimesCalledMatchers::AnyTimesMatcher.new
147
148
  install_method_callback return_value_block
@@ -154,7 +155,7 @@ module RR
154
155
  #
155
156
  # Passing in a block sets the return value.
156
157
  #
157
- # mock(subject).method_name.times(4) {:return_value}
158
+ # mock(subject).method_name.times(4) {:return_value}
158
159
  def times(matcher_value, &return_value_block)
159
160
  @times_matcher = TimesCalledMatchers::TimesCalledMatcher.create(matcher_value)
160
161
  install_method_callback return_value_block
@@ -269,8 +270,8 @@ module RR
269
270
  self
270
271
  end
271
272
  alias_method :strong, :verify_method_signature
272
-
273
- protected
273
+
274
+ protected
274
275
  def install_method_callback(block)
275
276
  if block
276
277
  if implementation_is_original_method?
@@ -323,14 +324,15 @@ module RR
323
324
  def verify_method_signature?
324
325
  !!@verify_method_signature
325
326
  end
326
- alias_method :strong?, :verify_method_signature?
327
+ alias_method :strong?, :verify_method_signature?
327
328
 
328
- protected
329
+ protected
329
330
  def implementation_strategy
330
331
  double_definition_create.implementation_strategy
331
332
  end
332
333
  end
333
334
  include StateQueryMethods
335
+
334
336
  include ::RR::DoubleDefinitions::Strategies::StrategyMethods
335
337
 
336
338
  def mock(subject=DoubleDefinitionCreate::NO_SUBJECT, method_name=nil, &definition_eval_block)
@@ -362,4 +364,4 @@ module RR
362
364
  end
363
365
  end
364
366
  end
365
- end
367
+ end
@@ -51,7 +51,7 @@ module RR
51
51
  subject.__id__ === NO_SUBJECT.__id__
52
52
  end
53
53
 
54
- protected
54
+ protected
55
55
  def add_verification_strategy(verification_strategy_class, subject=NO_SUBJECT, method_name=nil, &definition_eval_block)
56
56
  add_strategy(subject, method_name, definition_eval_block) do
57
57
  self.verification_strategy = verification_strategy_class.new(self)
@@ -105,8 +105,10 @@ module RR
105
105
  class DoubleDefinitionCreateError < Errors::RRError
106
106
  end
107
107
 
108
- # Verification Strategies
108
+ ## Verification Strategies
109
+
109
110
  include ::RR::DoubleDefinitions::Strategies::StrategyMethods
111
+
110
112
  def mock(subject=NO_SUBJECT, method_name=nil, &definition_eval_block)
111
113
  self.add_verification_strategy(::RR::DoubleDefinitions::Strategies::Verification::Mock, subject, method_name, &definition_eval_block)
112
114
  end
@@ -119,7 +121,8 @@ module RR
119
121
  self.add_verification_strategy(::RR::DoubleDefinitions::Strategies::Verification::DontAllow, subject, method_name, &definition_eval_block)
120
122
  end
121
123
 
122
- # Implementation Strategies
124
+ ## Implementation Strategies
125
+
123
126
  def proxy(subject=NO_SUBJECT, method_name=nil, &definition_eval_block)
124
127
  self.add_implementation_strategy(::RR::DoubleDefinitions::Strategies::Implementation::Proxy, subject, method_name, &definition_eval_block)
125
128
  end
@@ -128,7 +131,8 @@ module RR
128
131
  self.add_implementation_strategy(::RR::DoubleDefinitions::Strategies::Implementation::StronglyTypedReimplementation, subject, method_name, &definition_eval_block)
129
132
  end
130
133
 
131
- # DoubleInjection Strategies
134
+ ## DoubleInjection Strategies
135
+
132
136
  def instance_of(subject=NO_SUBJECT, method_name=nil, &definition_eval_block)
133
137
  self.add_double_injection_strategy(::RR::DoubleDefinitions::Strategies::DoubleInjection::AnyInstanceOf, subject, method_name, &definition_eval_block)
134
138
  end
@@ -136,4 +140,4 @@ module RR
136
140
  alias_method :all_instances_of, :instance_of
137
141
  end
138
142
  end
139
- end
143
+ end