rr 0.3.11 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. data/CHANGES +8 -3
  2. data/README +130 -39
  3. data/Rakefile +6 -5
  4. data/lib/rr.rb +8 -8
  5. data/lib/rr/adapters/rr_methods.rb +228 -0
  6. data/lib/rr/adapters/rspec.rb +1 -1
  7. data/lib/rr/adapters/test_unit.rb +1 -1
  8. data/lib/rr/double.rb +294 -89
  9. data/lib/rr/{scenario_creator.rb → double_creator.rb} +65 -66
  10. data/lib/rr/{scenario_definition.rb → double_definition.rb} +36 -36
  11. data/lib/rr/{scenario_definition_builder.rb → double_definition_builder.rb} +3 -3
  12. data/lib/rr/double_insertion.rb +132 -0
  13. data/lib/rr/{scenario_matches.rb → double_matches.rb} +2 -2
  14. data/lib/rr/{scenario_method_proxy.rb → double_method_proxy.rb} +2 -2
  15. data/lib/rr/errors/argument_equality_error.rb +3 -3
  16. data/lib/rr/errors/rr_error.rb +13 -13
  17. data/lib/rr/errors/scenario_definition_error.rb +3 -3
  18. data/lib/rr/errors/scenario_not_found_error.rb +3 -3
  19. data/lib/rr/errors/scenario_order_error.rb +3 -3
  20. data/lib/rr/errors/times_called_error.rb +3 -3
  21. data/lib/rr/expectations/any_argument_expectation.rb +1 -1
  22. data/lib/rr/expectations/argument_equality_expectation.rb +1 -1
  23. data/lib/rr/expectations/times_called_expectation.rb +1 -1
  24. data/lib/rr/hash_with_object_id_key.rb +1 -1
  25. data/lib/rr/space.rb +40 -40
  26. data/lib/rr/times_called_matchers/any_times_matcher.rb +13 -13
  27. data/lib/rr/times_called_matchers/at_least_matcher.rb +11 -11
  28. data/lib/rr/times_called_matchers/at_most_matcher.rb +16 -16
  29. data/lib/rr/times_called_matchers/integer_matcher.rb +13 -13
  30. data/lib/rr/times_called_matchers/non_terminal.rb +21 -21
  31. data/lib/rr/times_called_matchers/proc_matcher.rb +7 -7
  32. data/lib/rr/times_called_matchers/range_matcher.rb +14 -14
  33. data/lib/rr/times_called_matchers/terminal.rb +16 -16
  34. data/lib/rr/times_called_matchers/times_called_matcher.rb +32 -32
  35. data/spec/core_spec_suite.rb +18 -0
  36. data/{examples → spec}/environment_fixture_setup.rb +0 -1
  37. data/{examples/high_level_example.rb → spec/high_level_spec.rb} +11 -11
  38. data/spec/rr/adapters/rr_methods_argument_matcher_spec.rb +67 -0
  39. data/spec/rr/adapters/rr_methods_creator_spec.rb +365 -0
  40. data/spec/rr/adapters/rr_methods_space_spec.rb +134 -0
  41. data/spec/rr/adapters/rr_methods_spec_helper.rb +11 -0
  42. data/{examples/rr/extensions/instance_methods_times_matcher_example.rb → spec/rr/adapters/rr_methods_times_matcher_spec.rb} +4 -4
  43. data/spec/rr/double/double_insertion_bind_spec.rb +78 -0
  44. data/spec/rr/double/double_insertion_dispatching_spec.rb +221 -0
  45. data/spec/rr/double/double_insertion_has_original_method_spec.rb +56 -0
  46. data/spec/rr/double/double_insertion_register_scenario_spec.rb +24 -0
  47. data/spec/rr/double/double_insertion_reset_spec.rb +89 -0
  48. data/spec/rr/double/double_insertion_spec.rb +66 -0
  49. data/spec/rr/double/double_insertion_verify_spec.rb +23 -0
  50. data/spec/rr/double_creator_spec.rb +454 -0
  51. data/{examples/rr/scenario_definition_example.rb → spec/rr/double_definition_spec.rb} +143 -143
  52. data/spec/rr/double_method_proxy_spec.rb +71 -0
  53. data/spec/rr/double_spec.rb +654 -0
  54. data/spec/rr/errors/rr_error_spec.rb +65 -0
  55. data/spec/rr/expectations/any_argument_expectation_spec.rb +47 -0
  56. data/spec/rr/expectations/anything_argument_equality_expectation_spec.rb +38 -0
  57. data/spec/rr/expectations/argument_equality_expectation_spec.rb +58 -0
  58. data/spec/rr/expectations/boolean_argument_equality_expectation_spec.rb +53 -0
  59. data/spec/rr/expectations/duck_type_argument_equality_expectation_spec.rb +71 -0
  60. data/spec/rr/expectations/is_a_argument_equality_expectation_spec.rb +51 -0
  61. data/spec/rr/expectations/numeric_argument_equality_expectation_spec.rb +47 -0
  62. data/spec/rr/expectations/range_argument_equality_expectation_spec.rb +59 -0
  63. data/spec/rr/expectations/regexp_argument_equality_expectation_spec.rb +72 -0
  64. data/spec/rr/expectations/times_called_expectation/times_called_expectation_any_times_spec.rb +43 -0
  65. data/spec/rr/expectations/times_called_expectation/times_called_expectation_at_least_spec.rb +67 -0
  66. data/spec/rr/expectations/times_called_expectation/times_called_expectation_at_most_spec.rb +71 -0
  67. data/spec/rr/expectations/times_called_expectation/times_called_expectation_helper.rb +21 -0
  68. data/spec/rr/expectations/times_called_expectation/times_called_expectation_integer_spec.rb +103 -0
  69. data/spec/rr/expectations/times_called_expectation/times_called_expectation_proc_spec.rb +79 -0
  70. data/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb +81 -0
  71. data/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb +40 -0
  72. data/spec/rr/rspec/rspec_adapter_spec.rb +65 -0
  73. data/spec/rr/rspec/rspec_backtrace_tweaking_spec.rb +52 -0
  74. data/spec/rr/rspec/rspec_usage_spec.rb +67 -0
  75. data/spec/rr/space/hash_with_object_id_key_spec.rb +88 -0
  76. data/spec/rr/space/space_create_spec.rb +278 -0
  77. data/spec/rr/space/space_helper.rb +7 -0
  78. data/spec/rr/space/space_register_spec.rb +32 -0
  79. data/spec/rr/space/space_reset_spec.rb +131 -0
  80. data/spec/rr/space/space_spec.rb +32 -0
  81. data/spec/rr/space/space_verify_spec.rb +181 -0
  82. data/{examples → spec}/rr/test_unit/test_helper.rb +1 -1
  83. data/{examples → spec}/rr/test_unit/test_unit_backtrace_test.rb +0 -0
  84. data/{examples → spec}/rr/test_unit/test_unit_integration_test.rb +4 -4
  85. data/spec/rr/times_called_matchers/any_times_matcher_spec.rb +47 -0
  86. data/spec/rr/times_called_matchers/at_least_matcher_spec.rb +55 -0
  87. data/spec/rr/times_called_matchers/at_most_matcher_spec.rb +70 -0
  88. data/spec/rr/times_called_matchers/integer_matcher_spec.rb +70 -0
  89. data/spec/rr/times_called_matchers/proc_matcher_spec.rb +55 -0
  90. data/spec/rr/times_called_matchers/range_matcher_spec.rb +76 -0
  91. data/spec/rr/times_called_matchers/times_called_matcher_spec.rb +118 -0
  92. data/spec/rspec_spec_suite.rb +16 -0
  93. data/spec/spec_helper.rb +9 -0
  94. data/{examples/example_suite.rb → spec/spec_suite.rb} +3 -3
  95. data/{examples/test_unit_example_suite.rb → spec/test_unit_spec_suite.rb} +0 -0
  96. metadata +93 -93
  97. data/examples/core_example_suite.rb +0 -31
  98. data/examples/example_helper.rb +0 -9
  99. data/examples/rr/double/double_bind_example.rb +0 -70
  100. data/examples/rr/double/double_dispatching_example.rb +0 -236
  101. data/examples/rr/double/double_example.rb +0 -66
  102. data/examples/rr/double/double_has_original_method_example.rb +0 -56
  103. data/examples/rr/double/double_register_scenario_example.rb +0 -24
  104. data/examples/rr/double/double_reset_example.rb +0 -89
  105. data/examples/rr/double/double_verify_example.rb +0 -23
  106. data/examples/rr/errors/rr_error_example.rb +0 -65
  107. data/examples/rr/expectations/any_argument_expectation_example.rb +0 -52
  108. data/examples/rr/expectations/anything_argument_equality_expectation_example.rb +0 -38
  109. data/examples/rr/expectations/argument_equality_expectation_example.rb +0 -62
  110. data/examples/rr/expectations/boolean_argument_equality_expectation_example.rb +0 -48
  111. data/examples/rr/expectations/duck_type_argument_equality_expectation_example.rb +0 -67
  112. data/examples/rr/expectations/is_a_argument_equality_expectation_example.rb +0 -50
  113. data/examples/rr/expectations/numeric_argument_equality_expectation_example.rb +0 -46
  114. data/examples/rr/expectations/range_argument_equality_expectation_example.rb +0 -59
  115. data/examples/rr/expectations/regexp_argument_equality_expectation_example.rb +0 -67
  116. data/examples/rr/expectations/times_called_expectation/times_called_expectation_any_times_example.rb +0 -50
  117. data/examples/rr/expectations/times_called_expectation/times_called_expectation_at_least_example.rb +0 -73
  118. data/examples/rr/expectations/times_called_expectation/times_called_expectation_at_most_example.rb +0 -77
  119. data/examples/rr/expectations/times_called_expectation/times_called_expectation_example.rb +0 -42
  120. data/examples/rr/expectations/times_called_expectation/times_called_expectation_helper.rb +0 -20
  121. data/examples/rr/expectations/times_called_expectation/times_called_expectation_integer_example.rb +0 -111
  122. data/examples/rr/expectations/times_called_expectation/times_called_expectation_proc_example.rb +0 -88
  123. data/examples/rr/expectations/times_called_expectation/times_called_expectation_range_example.rb +0 -90
  124. data/examples/rr/extensions/instance_methods_argument_matcher_example.rb +0 -65
  125. data/examples/rr/extensions/instance_methods_creator_example.rb +0 -363
  126. data/examples/rr/extensions/instance_methods_example_helper.rb +0 -11
  127. data/examples/rr/extensions/instance_methods_space_example.rb +0 -122
  128. data/examples/rr/rspec/rspec_adapter_example.rb +0 -63
  129. data/examples/rr/rspec/rspec_backtrace_tweaking_example.rb +0 -36
  130. data/examples/rr/rspec/rspec_usage_example.rb +0 -65
  131. data/examples/rr/scenario_creator_example.rb +0 -459
  132. data/examples/rr/scenario_example.rb +0 -701
  133. data/examples/rr/scenario_method_proxy_example.rb +0 -71
  134. data/examples/rr/space/hash_with_object_id_key_example.rb +0 -86
  135. data/examples/rr/space/space_create_example.rb +0 -278
  136. data/examples/rr/space/space_example.rb +0 -29
  137. data/examples/rr/space/space_helper.rb +0 -7
  138. data/examples/rr/space/space_register_example.rb +0 -32
  139. data/examples/rr/space/space_reset_example.rb +0 -120
  140. data/examples/rr/space/space_verify_example.rb +0 -169
  141. data/examples/rr/times_called_matchers/any_times_matcher_example.rb +0 -63
  142. data/examples/rr/times_called_matchers/at_least_matcher_example.rb +0 -70
  143. data/examples/rr/times_called_matchers/at_most_matcher_example.rb +0 -85
  144. data/examples/rr/times_called_matchers/integer_matcher_example.rb +0 -91
  145. data/examples/rr/times_called_matchers/proc_matcher_example.rb +0 -77
  146. data/examples/rr/times_called_matchers/range_matcher_example.rb +0 -97
  147. data/examples/rr/times_called_matchers/times_called_matcher_example.rb +0 -53
  148. data/examples/rspec_example_suite.rb +0 -25
  149. data/lib/rr/extensions/instance_methods.rb +0 -228
  150. data/lib/rr/scenario.rb +0 -337
@@ -0,0 +1,16 @@
1
+ require "rubygems"
2
+ require "spec"
3
+
4
+ class RspecExampleSuite
5
+ def run
6
+ puts "Running Rspec Example Suite"
7
+ dir = File.dirname(__FILE__)
8
+ Dir["#{dir}/rr/rspec/**/*_spec.rb"].each do |file|
9
+ require file
10
+ end
11
+ end
12
+ end
13
+
14
+ if $0 == __FILE__
15
+ RspecExampleSuite.new.run
16
+ end
@@ -0,0 +1,9 @@
1
+ dir = File.dirname(__FILE__)
2
+ require "#{dir}/environment_fixture_setup"
3
+ require "spec/rr/space/space_helper"
4
+ require "spec/rr/expectations/times_called_expectation/times_called_expectation_helper"
5
+ require "spec/rr/adapters/rr_methods_spec_helper"
6
+
7
+ Spec::Runner.configure do |config|
8
+ config.mock_with RR::Adapters::Rspec
9
+ end
@@ -6,15 +6,15 @@ class ExampleSuite
6
6
  end
7
7
 
8
8
  def run_core_examples
9
- system("ruby #{dir}/core_example_suite.rb") || raise("Core suite Failed")
9
+ system("ruby #{dir}/core_spec_suite.rb") || raise("Core suite Failed")
10
10
  end
11
11
 
12
12
  def run_rspec_examples
13
- system("ruby #{dir}/rspec_example_suite.rb") || raise("Rspec suite Failed")
13
+ system("ruby #{dir}/rspec_spec_suite.rb") || raise("Rspec suite Failed")
14
14
  end
15
15
 
16
16
  def run_test_unit_examples
17
- system("ruby #{dir}/test_unit_example_suite.rb") || raise("Test::Unit suite Failed")
17
+ system("ruby #{dir}/test_unit_spec_suite.rb") || raise("Test::Unit suite Failed")
18
18
  end
19
19
 
20
20
  def dir
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
2
+ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: rr
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.11
7
- date: 2007-09-06 00:00:00 -07:00
6
+ version: 0.4.0
7
+ date: 2007-12-30 00:00:00 -08:00
8
8
  summary: RR (Double Ruby) is a double framework that features a rich selection of double techniques and a terse syntax. http://xunitpatterns.com/Test%20Double.html
9
9
  require_paths:
10
10
  - lib
@@ -29,110 +29,110 @@ post_install_message:
29
29
  authors:
30
30
  - Brian Takita
31
31
  files:
32
- - README
33
32
  - Rakefile
34
33
  - CHANGES
35
- - lib/rr/extensions/instance_methods.rb
36
- - lib/rr/adapters/test_unit.rb
37
- - lib/rr/adapters/rspec.rb
34
+ - README
35
+ - lib/rr.rb
36
+ - lib/rr/times_called_matchers/any_times_matcher.rb
37
+ - lib/rr/times_called_matchers/at_most_matcher.rb
38
+ - lib/rr/times_called_matchers/times_called_matcher.rb
39
+ - lib/rr/times_called_matchers/at_least_matcher.rb
40
+ - lib/rr/times_called_matchers/proc_matcher.rb
41
+ - lib/rr/times_called_matchers/integer_matcher.rb
42
+ - lib/rr/times_called_matchers/non_terminal.rb
43
+ - lib/rr/times_called_matchers/terminal.rb
44
+ - lib/rr/times_called_matchers/range_matcher.rb
45
+ - lib/rr/hash_with_object_id_key.rb
46
+ - lib/rr/double_insertion.rb
47
+ - lib/rr/double_creator.rb
38
48
  - lib/rr/expectations/argument_equality_expectation.rb
39
49
  - lib/rr/expectations/times_called_expectation.rb
40
50
  - lib/rr/expectations/any_argument_expectation.rb
41
- - lib/rr/scenario.rb
42
- - lib/rr/double.rb
43
- - lib/rr/errors/times_called_error.rb
51
+ - lib/rr/double_matches.rb
44
52
  - lib/rr/errors/scenario_not_found_error.rb
45
- - lib/rr/errors/scenario_order_error.rb
46
53
  - lib/rr/errors/argument_equality_error.rb
54
+ - lib/rr/errors/scenario_order_error.rb
47
55
  - lib/rr/errors/rr_error.rb
56
+ - lib/rr/errors/times_called_error.rb
48
57
  - lib/rr/errors/scenario_definition_error.rb
49
- - lib/rr/scenario_creator.rb
58
+ - lib/rr/double_definition_builder.rb
59
+ - lib/rr/adapters/rr_methods.rb
60
+ - lib/rr/adapters/test_unit.rb
61
+ - lib/rr/adapters/rspec.rb
62
+ - lib/rr/double_definition.rb
63
+ - lib/rr/double_method_proxy.rb
50
64
  - lib/rr/space.rb
51
- - lib/rr/scenario_definition_builder.rb
52
- - lib/rr/scenario_definition.rb
53
65
  - lib/rr/wildcard_matchers/boolean.rb
54
- - lib/rr/wildcard_matchers/anything.rb
55
- - lib/rr/wildcard_matchers/numeric.rb
56
66
  - lib/rr/wildcard_matchers/duck_type.rb
67
+ - lib/rr/wildcard_matchers/range.rb
57
68
  - lib/rr/wildcard_matchers/regexp.rb
69
+ - lib/rr/wildcard_matchers/numeric.rb
58
70
  - lib/rr/wildcard_matchers/is_a.rb
59
- - lib/rr/wildcard_matchers/range.rb
60
- - lib/rr/times_called_matchers/at_least_matcher.rb
61
- - lib/rr/times_called_matchers/range_matcher.rb
62
- - lib/rr/times_called_matchers/integer_matcher.rb
63
- - lib/rr/times_called_matchers/non_terminal.rb
64
- - lib/rr/times_called_matchers/proc_matcher.rb
65
- - lib/rr/times_called_matchers/times_called_matcher.rb
66
- - lib/rr/times_called_matchers/at_most_matcher.rb
67
- - lib/rr/times_called_matchers/any_times_matcher.rb
68
- - lib/rr/times_called_matchers/terminal.rb
69
- - lib/rr/scenario_method_proxy.rb
70
- - lib/rr/scenario_matches.rb
71
- - lib/rr/hash_with_object_id_key.rb
72
- - lib/rr.rb
73
- - examples/rr/extensions/instance_methods_creator_example.rb
74
- - examples/rr/extensions/instance_methods_example_helper.rb
75
- - examples/rr/extensions/instance_methods_times_matcher_example.rb
76
- - examples/rr/extensions/instance_methods_argument_matcher_example.rb
77
- - examples/rr/extensions/instance_methods_space_example.rb
78
- - examples/rr/expectations/argument_equality_expectation_example.rb
79
- - examples/rr/expectations/anything_argument_equality_expectation_example.rb
80
- - examples/rr/expectations/times_called_expectation/times_called_expectation_at_least_example.rb
81
- - examples/rr/expectations/times_called_expectation/times_called_expectation_range_example.rb
82
- - examples/rr/expectations/times_called_expectation/times_called_expectation_integer_example.rb
83
- - examples/rr/expectations/times_called_expectation/times_called_expectation_example.rb
84
- - examples/rr/expectations/times_called_expectation/times_called_expectation_proc_example.rb
85
- - examples/rr/expectations/times_called_expectation/times_called_expectation_helper.rb
86
- - examples/rr/expectations/times_called_expectation/times_called_expectation_at_most_example.rb
87
- - examples/rr/expectations/times_called_expectation/times_called_expectation_any_times_example.rb
88
- - examples/rr/expectations/any_argument_expectation_example.rb
89
- - examples/rr/expectations/is_a_argument_equality_expectation_example.rb
90
- - examples/rr/expectations/numeric_argument_equality_expectation_example.rb
91
- - examples/rr/expectations/boolean_argument_equality_expectation_example.rb
92
- - examples/rr/expectations/duck_type_argument_equality_expectation_example.rb
93
- - examples/rr/expectations/regexp_argument_equality_expectation_example.rb
94
- - examples/rr/expectations/range_argument_equality_expectation_example.rb
95
- - examples/rr/rspec/rspec_adapter_example.rb
96
- - examples/rr/rspec/rspec_usage_example.rb
97
- - examples/rr/rspec/rspec_backtrace_tweaking_example.rb
98
- - examples/rr/test_unit/test_helper.rb
99
- - examples/rr/test_unit/test_unit_integration_test.rb
100
- - examples/rr/test_unit/test_unit_backtrace_test.rb
101
- - examples/rr/scenario_example.rb
102
- - examples/rr/double/double_bind_example.rb
103
- - examples/rr/double/double_dispatching_example.rb
104
- - examples/rr/double/double_example.rb
105
- - examples/rr/double/double_reset_example.rb
106
- - examples/rr/double/double_verify_example.rb
107
- - examples/rr/double/double_register_scenario_example.rb
108
- - examples/rr/double/double_has_original_method_example.rb
109
- - examples/rr/space/space_example.rb
110
- - examples/rr/space/space_reset_example.rb
111
- - examples/rr/space/space_create_example.rb
112
- - examples/rr/space/space_helper.rb
113
- - examples/rr/space/space_register_example.rb
114
- - examples/rr/space/space_verify_example.rb
115
- - examples/rr/space/hash_with_object_id_key_example.rb
116
- - examples/rr/times_called_matchers/proc_matcher_example.rb
117
- - examples/rr/times_called_matchers/times_called_matcher_example.rb
118
- - examples/rr/times_called_matchers/at_most_matcher_example.rb
119
- - examples/rr/times_called_matchers/any_times_matcher_example.rb
120
- - examples/rr/times_called_matchers/at_least_matcher_example.rb
121
- - examples/rr/times_called_matchers/range_matcher_example.rb
122
- - examples/rr/times_called_matchers/integer_matcher_example.rb
123
- - examples/rr/scenario_creator_example.rb
124
- - examples/rr/scenario_method_proxy_example.rb
125
- - examples/rr/scenario_definition_example.rb
126
- - examples/rr/errors/rr_error_example.rb
127
- - examples/rspec_example_suite.rb
128
- - examples/high_level_example.rb
129
- - examples/test_unit_example_suite.rb
130
- - examples/example_suite.rb
131
- - examples/environment_fixture_setup.rb
132
- - examples/example_helper.rb
133
- - examples/core_example_suite.rb
134
- test_files: []
135
-
71
+ - lib/rr/wildcard_matchers/anything.rb
72
+ - lib/rr/double.rb
73
+ - spec/environment_fixture_setup.rb
74
+ - spec/spec_suite.rb
75
+ - spec/test_unit_spec_suite.rb
76
+ - spec/spec_helper.rb
77
+ - spec/high_level_spec.rb
78
+ - spec/rr/rspec/rspec_backtrace_tweaking_spec.rb
79
+ - spec/rr/rspec/rspec_usage_spec.rb
80
+ - spec/rr/rspec/rspec_adapter_spec.rb
81
+ - spec/rr/double_spec.rb
82
+ - spec/rr/times_called_matchers/proc_matcher_spec.rb
83
+ - spec/rr/times_called_matchers/any_times_matcher_spec.rb
84
+ - spec/rr/times_called_matchers/range_matcher_spec.rb
85
+ - spec/rr/times_called_matchers/times_called_matcher_spec.rb
86
+ - spec/rr/times_called_matchers/at_least_matcher_spec.rb
87
+ - spec/rr/times_called_matchers/at_most_matcher_spec.rb
88
+ - spec/rr/times_called_matchers/integer_matcher_spec.rb
89
+ - spec/rr/double_creator_spec.rb
90
+ - spec/rr/space/space_create_spec.rb
91
+ - spec/rr/space/hash_with_object_id_key_spec.rb
92
+ - spec/rr/space/space_register_spec.rb
93
+ - spec/rr/space/space_verify_spec.rb
94
+ - spec/rr/space/space_reset_spec.rb
95
+ - spec/rr/space/space_spec.rb
96
+ - spec/rr/space/space_helper.rb
97
+ - spec/rr/expectations/times_called_expectation/times_called_expectation_proc_spec.rb
98
+ - spec/rr/expectations/times_called_expectation/times_called_expectation_helper.rb
99
+ - spec/rr/expectations/times_called_expectation/times_called_expectation_at_least_spec.rb
100
+ - spec/rr/expectations/times_called_expectation/times_called_expectation_integer_spec.rb
101
+ - spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
102
+ - spec/rr/expectations/times_called_expectation/times_called_expectation_at_most_spec.rb
103
+ - spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
104
+ - spec/rr/expectations/times_called_expectation/times_called_expectation_any_times_spec.rb
105
+ - spec/rr/expectations/boolean_argument_equality_expectation_spec.rb
106
+ - spec/rr/expectations/regexp_argument_equality_expectation_spec.rb
107
+ - spec/rr/expectations/anything_argument_equality_expectation_spec.rb
108
+ - spec/rr/expectations/is_a_argument_equality_expectation_spec.rb
109
+ - spec/rr/expectations/any_argument_expectation_spec.rb
110
+ - spec/rr/expectations/argument_equality_expectation_spec.rb
111
+ - spec/rr/expectations/numeric_argument_equality_expectation_spec.rb
112
+ - spec/rr/expectations/duck_type_argument_equality_expectation_spec.rb
113
+ - spec/rr/expectations/range_argument_equality_expectation_spec.rb
114
+ - spec/rr/errors/rr_error_spec.rb
115
+ - spec/rr/adapters/rr_methods_spec_helper.rb
116
+ - spec/rr/adapters/rr_methods_times_matcher_spec.rb
117
+ - spec/rr/adapters/rr_methods_space_spec.rb
118
+ - spec/rr/adapters/rr_methods_creator_spec.rb
119
+ - spec/rr/adapters/rr_methods_argument_matcher_spec.rb
120
+ - spec/rr/double_definition_spec.rb
121
+ - spec/rr/double/double_insertion_bind_spec.rb
122
+ - spec/rr/double/double_insertion_dispatching_spec.rb
123
+ - spec/rr/double/double_insertion_has_original_method_spec.rb
124
+ - spec/rr/double/double_insertion_verify_spec.rb
125
+ - spec/rr/double/double_insertion_spec.rb
126
+ - spec/rr/double/double_insertion_register_scenario_spec.rb
127
+ - spec/rr/double/double_insertion_reset_spec.rb
128
+ - spec/rr/double_method_proxy_spec.rb
129
+ - spec/rr/test_unit/test_unit_backtrace_test.rb
130
+ - spec/rr/test_unit/test_helper.rb
131
+ - spec/rr/test_unit/test_unit_integration_test.rb
132
+ - spec/rspec_spec_suite.rb
133
+ - spec/core_spec_suite.rb
134
+ test_files:
135
+ - spec/high_level_spec.rb
136
136
  rdoc_options:
137
137
  - --main
138
138
  - README
@@ -1,31 +0,0 @@
1
- require "rubygems"
2
- require "spec"
3
-
4
- class CoreExampleSuite
5
- def run
6
- options = ::Spec::Runner::OptionParser.new.parse(ARGV.dup, STDERR, STDOUT, false)
7
- options.configure
8
- $behaviour_runner = options.create_behaviour_runner
9
-
10
- require_specs
11
-
12
- puts "Running Rspec Example Suite"
13
- $behaviour_runner.run(ARGV, false)
14
- end
15
-
16
- def require_specs
17
- exclusions = []
18
- exclusions << "rspec/"
19
- exclusions << "test_unit/"
20
-
21
- Dir["#{File.dirname(__FILE__)}/**/*_example.rb"].each do |file|
22
- unless exclusions.any? {|match| file.include?(match)}
23
- require file
24
- end
25
- end
26
- end
27
- end
28
-
29
- if $0 == __FILE__
30
- CoreExampleSuite.new.run
31
- end
@@ -1,9 +0,0 @@
1
- dir = File.dirname(__FILE__)
2
- require "#{dir}/environment_fixture_setup"
3
- require "examples/rr/space/space_helper"
4
- require "examples/rr/expectations/times_called_expectation/times_called_expectation_helper"
5
- require "examples/rr/extensions/instance_methods_example_helper"
6
-
7
- Spec::Runner.configure do |config|
8
- config.mock_with RR::Adapters::Rspec
9
- end
@@ -1,70 +0,0 @@
1
- require "examples/example_helper"
2
-
3
- module RR
4
- describe Double, "#bind with an existing method" do
5
- before do
6
- @space = Space.new
7
- @object = Object.new
8
- @method_name = :foobar
9
- def @object.foobar; :original_foobar; end
10
- @original_method = @object.method(:foobar)
11
- @object.methods.should include(@method_name.to_s)
12
- @double = Double.new(@space, @object, @method_name)
13
- end
14
-
15
- it "overrides the original method with the double's dispatching methods" do
16
- @object.respond_to?(:__rr__foobar).should == false
17
- @double.bind
18
- @object.respond_to?(:__rr__foobar).should == true
19
-
20
- rr_foobar_called = false
21
- (class << @object; self; end).class_eval do
22
- define_method :__rr__foobar do
23
- rr_foobar_called = true
24
- end
25
- end
26
-
27
- rr_foobar_called.should == false
28
- @object.foobar
29
- rr_foobar_called.should == true
30
- end
31
-
32
- it "stores original method in __rr__original_method_name" do
33
- @double.bind
34
- @object.respond_to?(:__rr__original_foobar).should == true
35
- @object.method(:__rr__original_foobar).should == @original_method
36
- end
37
- end
38
-
39
- describe Double, "#bind without an existing method" do
40
- before do
41
- @space = Space.new
42
- @object = Object.new
43
- @method_name = :foobar
44
- @object.methods.should_not include(@method_name.to_s)
45
- @double = Double.new(@space, @object, @method_name)
46
- end
47
-
48
- it "overrides the original method with the double's dispatching methods" do
49
- @object.respond_to?(:__rr__foobar).should == false
50
- @double.bind
51
- @object.respond_to?(:__rr__foobar).should == true
52
-
53
- rr_foobar_called = false
54
- (class << @object; self; end).class_eval do
55
- define_method :__rr__foobar do
56
- rr_foobar_called = true
57
- end
58
- end
59
-
60
- rr_foobar_called.should == false
61
- @object.foobar
62
- rr_foobar_called.should == true
63
- end
64
-
65
- it "stores original method in __rr__original_method_name" do
66
- @double.bind
67
- @object.respond_to?(:__rr__original_foobar).should == false
68
- end
69
- end
70
- end
@@ -1,236 +0,0 @@
1
- require "examples/example_helper"
2
-
3
- module RR
4
- describe Double, "method dispatching", :shared => true do
5
- before do
6
- @space = Space.new
7
- @object = Object.new
8
- @method_name = :foobar
9
- @object.methods.should_not include(@method_name.to_s)
10
- @double = @space.double(@object, @method_name)
11
- end
12
- end
13
-
14
- describe Double, " method dispatching where method name has a ! in it" do
15
- before do
16
- @space = Space.new
17
- @object = Object.new
18
- @method_name = :foobar!
19
- @object.methods.should_not include(@method_name.to_s)
20
- @double = @space.double(@object, @method_name)
21
- end
22
-
23
- it "executes the block" do
24
- scenario = @space.scenario(@double)
25
- scenario.with(1, 2) {:return_value}
26
- @object.foobar!(1, 2).should == :return_value
27
- end
28
- end
29
-
30
- describe Double, " method dispatching where method name has a ? in it" do
31
- before do
32
- @space = Space.new
33
- @object = Object.new
34
- @method_name = :foobar?
35
- @object.methods.should_not include(@method_name.to_s)
36
- @double = @space.double(@object, @method_name)
37
- end
38
-
39
- it "executes the block" do
40
- scenario = @space.scenario(@double)
41
- scenario.with(1, 2) {:return_value}
42
- @object.foobar?(1, 2).should == :return_value
43
- end
44
- end
45
-
46
- describe Double, " method dispatching where the scenario takes a block" do
47
- it_should_behave_like "RR::Double method dispatching"
48
-
49
- it "executes the block" do
50
- method_fixture = Object.new
51
- class << method_fixture
52
- def method_with_block(a, b)
53
- yield(a,b)
54
- end
55
- end
56
- scenario = @space.scenario(@double)
57
- scenario.with(1, 2).implemented_by(method_fixture.method(:method_with_block))
58
- @object.foobar(1, 2) {|a, b| [b, a]}.should == [2, 1]
59
- end
60
- end
61
-
62
- describe Double, " method dispatching where there are no scenarios with duplicate ArgumentExpectations" do
63
- it_should_behave_like "RR::Double method dispatching"
64
-
65
- it "dispatches to Scenario that have an exact match" do
66
- scenario1_with_exact_match = @space.scenario(@double)
67
- scenario1_with_exact_match.with(:exact_match_1).returns {:return_1}
68
- scenario_with_no_match = @space.scenario(@double)
69
- scenario_with_no_match.with("nothing that matches").returns {:no_match}
70
- scenario2_with_exact_match = @space.scenario(@double)
71
- scenario2_with_exact_match.with(:exact_match_2).returns {:return_2}
72
-
73
- @object.foobar(:exact_match_1).should == :return_1
74
- @object.foobar(:exact_match_2).should == :return_2
75
- end
76
-
77
- it "dispatches to Scenario that have a wildcard match" do
78
- scenario_with_wildcard_match = @space.scenario(@double)
79
- scenario_with_wildcard_match.with_any_args.returns {:wild_card_value}
80
- scenario_with_no_match = @space.scenario(@double)
81
- scenario_with_no_match.with("nothing that matches").returns {:no_match}
82
-
83
- @object.foobar(:wildcard_match_1).should == :wild_card_value
84
- @object.foobar(:wildcard_match_2, 3).should == :wild_card_value
85
- end
86
- end
87
-
88
- describe Double, " method dispatching where there are scenarios" do
89
- it_should_behave_like "RR::Double method dispatching"
90
-
91
- it "raises ScenarioNotFoundError error when arguments do not match a scenario" do
92
- scenario_1 = @space.scenario(@double)
93
- scenario_1.with(1, 2)
94
-
95
- scenario_2 = @space.scenario(@double)
96
- scenario_2.with(3)
97
-
98
- proc {@object.foobar(:arg1, :arg2)}.should raise_error(
99
- Errors::ScenarioNotFoundError,
100
- "No scenario for foobar(:arg1, :arg2) in\n" <<
101
- "- foobar(1, 2)\n" <<
102
- "- foobar(3)"
103
- )
104
- end
105
- end
106
-
107
- describe Double, " method dispatching where there are Scenarios with NonTerminal TimesCalledMatchers" do
108
- it_should_behave_like "RR::Double method dispatching"
109
-
110
- it "dispatches to Scenario with exact match" do
111
- scenario = scenario(1, 2) {:return_value}
112
- @object.foobar(1, 2).should == :return_value
113
- end
114
-
115
- it "matches to the last Scenario that was registered with an exact match" do
116
- scenario_1 = scenario(1, 2) {:value_1}
117
- scenario_2 = scenario(1, 2) {:value_2}
118
-
119
- @object.foobar(1, 2).should == :value_2
120
- end
121
-
122
- it "dispatches to Scenario with wildcard match" do
123
- scenario = scenario(anything) {:return_value}
124
- @object.foobar(:dont_care).should == :return_value
125
- end
126
-
127
- it "matches to the last Scenario that was registered with a wildcard match" do
128
- scenario_1 = scenario(anything) {:value_1}
129
- scenario_2 = scenario(anything) {:value_2}
130
-
131
- @object.foobar(:dont_care).should == :value_2
132
- end
133
-
134
- it "matches to Scenario with exact match Scenario even when a Scenario with wildcard match was registered later" do
135
- exact_scenario_registered_first = scenario(1, 2) {:exact_first}
136
- wildcard_scenario_registered_last = scenario(anything, anything) {:wildcard_last}
137
-
138
- @object.foobar(1, 2).should == :exact_first
139
- end
140
-
141
- def scenario(*arguments, &return_value)
142
- scenario = @space.scenario(@double)
143
- scenario.with(*arguments).any_number_of_times.returns(&return_value)
144
- scenario.should_not be_terminal
145
- scenario
146
- end
147
- end
148
-
149
- describe Double, " method dispatching where there are Terminal Scenarios with duplicate Exact Match ArgumentExpectations" do
150
- it_should_behave_like "RR::Double method dispatching"
151
-
152
- it "dispatches to Scenario that have an exact match" do
153
- scenario1_with_exact_match = scenario(:exact_match) {:return_1}
154
-
155
- @object.foobar(:exact_match).should == :return_1
156
- end
157
-
158
- it "dispatches to the first Scenario that have an exact match" do
159
- scenario1_with_exact_match = scenario(:exact_match) {:return_1}
160
- scenario2_with_exact_match = scenario(:exact_match) {:return_2}
161
-
162
- @object.foobar(:exact_match).should == :return_1
163
- end
164
-
165
- it "dispatches the second Scenario with an exact match
166
- when the first scenario's Times Called expectation is satisfied" do
167
- scenario1_with_exact_match = scenario(:exact_match) {:return_1}
168
- scenario2_with_exact_match = scenario(:exact_match) {:return_2}
169
-
170
- @object.foobar(:exact_match)
171
- @object.foobar(:exact_match).should == :return_2
172
- end
173
-
174
- it "raises TimesCalledError when all of the scenarios Times Called expectation is satisfied" do
175
- scenario1_with_exact_match = scenario(:exact_match) {:return_1}
176
- scenario2_with_exact_match = scenario(:exact_match) {:return_2}
177
-
178
- @object.foobar(:exact_match)
179
- @object.foobar(:exact_match)
180
- proc do
181
- @object.foobar(:exact_match)
182
- end.should raise_error(Errors::TimesCalledError)
183
- end
184
-
185
- def scenario(*arguments, &return_value)
186
- scenario = @space.scenario(@double)
187
- scenario.with(*arguments).once.returns(&return_value)
188
- scenario.should be_terminal
189
- scenario
190
- end
191
- end
192
-
193
- describe Double, " method dispatching where there are scenarios with duplicate Wildcard Match ArgumentExpectations" do
194
- it_should_behave_like "RR::Double method dispatching"
195
-
196
- it "dispatches to Scenario that have a wildcard match" do
197
- scenario_1 = scenario {:return_1}
198
-
199
- @object.foobar(:anything).should == :return_1
200
- end
201
-
202
- it "dispatches to the first Scenario that has a wildcard match" do
203
- scenario_1 = scenario {:return_1}
204
- scenario_2 = scenario {:return_2}
205
-
206
- @object.foobar(:anything).should == :return_1
207
- end
208
-
209
- it "dispatches the second Scenario with a wildcard match
210
- when the first scenario's Times Called expectation is satisfied" do
211
- scenario_1 = scenario {:return_1}
212
- scenario_2 = scenario {:return_2}
213
-
214
- @object.foobar(:anything)
215
- @object.foobar(:anything).should == :return_2
216
- end
217
-
218
- it "raises TimesCalledError when all of the scenarios Times Called expectation is satisfied" do
219
- scenario_1 = scenario {:return_1}
220
- scenario_2 = scenario {:return_2}
221
-
222
- @object.foobar(:anything)
223
- @object.foobar(:anything)
224
- proc do
225
- @object.foobar(:anything)
226
- end.should raise_error(Errors::TimesCalledError)
227
- end
228
-
229
- def scenario(&return_value)
230
- scenario = @space.scenario(@double)
231
- scenario.with_any_args.once.returns(&return_value)
232
- scenario.should be_terminal
233
- scenario
234
- end
235
- end
236
- end