rr 0.3.6 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGES CHANGED
@@ -1,3 +1,6 @@
1
+ * 0.3.7
2
+ - Fixed [#12928] Reset doubles fails on Rails association proxies
3
+
1
4
  * 0.3.6
2
5
  - Fixed [#12765] Issues with ObjectSpace._id2ref
3
6
 
data/Rakefile CHANGED
@@ -25,7 +25,7 @@ def run_suite
25
25
  end
26
26
 
27
27
  PKG_NAME = "rr"
28
- PKG_VERSION = "0.3.6"
28
+ PKG_VERSION = "0.3.7"
29
29
  PKG_FILES = FileList[
30
30
  '[A-Z]*',
31
31
  '*.rb',
@@ -130,4 +130,11 @@ describe "RR stub:" do
130
130
  @obj.to_s.should == "a value"
131
131
  @obj.to_sym.should == :crazy
132
132
  end
133
+
134
+ it "stubs instance_of" do
135
+ stub.instance_of(Date) do |o|
136
+ o.to_s {"The Date"}
137
+ end
138
+ Date.new.to_s.should == "The Date"
139
+ end
133
140
  end
@@ -0,0 +1,33 @@
1
+ require "examples/example_helper"
2
+
3
+ module RR
4
+ describe Double, "#original_method" do
5
+ before do
6
+ @space = Space.new
7
+ @object = Object.new
8
+ @method_name = :to_s
9
+ @double = Double.new(@space, @object, @method_name)
10
+ class << @double
11
+ public :original_method_name
12
+ end
13
+ end
14
+
15
+ it "returns true when method is still in object" do
16
+ @double.bind
17
+ @double.original_method.should == @object.method(@double.original_method_name)
18
+ end
19
+
20
+ it "returns false when respond_to is true and methods do not include method" do
21
+ @double.bind
22
+ @object.methods.should include(@double.original_method_name.to_s)
23
+ class << @object
24
+ undef_method :__rr__original_to_s
25
+ end
26
+ def @object.respond_to?(value)
27
+ true
28
+ end
29
+
30
+ @double.original_method.should be_nil
31
+ end
32
+ end
33
+ end
data/lib/rr/double.rb CHANGED
@@ -10,7 +10,7 @@ module RR
10
10
  @space = space
11
11
  @object = object
12
12
  @method_name = method_name.to_sym
13
- if @object.respond_to?(method_name)
13
+ if object_has_method?(method_name)
14
14
  meta.send(:alias_method, original_method_name, method_name)
15
15
  end
16
16
  @scenarios = []
@@ -60,7 +60,7 @@ module RR
60
60
  # The original method of the object. It returns nil if the object
61
61
  # does not have an original method.
62
62
  def original_method
63
- return nil unless @object.respond_to?(original_method_name)
63
+ return nil unless object_has_method?(original_method_name)
64
64
  return @object.method(original_method_name)
65
65
  end
66
66
 
@@ -120,6 +120,10 @@ module RR
120
120
  "__rr__original_#{@method_name}"
121
121
  end
122
122
 
123
+ def object_has_method?(method_name)
124
+ @object.methods.include?(method_name.to_s)
125
+ end
126
+
123
127
  def meta
124
128
  (class << @object; self; end)
125
129
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.3
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: rr
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.6
7
- date: 2007-08-01 00:00:00 -07:00
6
+ version: 0.3.7
7
+ date: 2007-08-09 00:00:00 -07: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,106 +29,107 @@ post_install_message:
29
29
  authors:
30
30
  - Brian Takita
31
31
  files:
32
+ - README
32
33
  - Rakefile
33
34
  - CHANGES
34
- - README
35
- - lib/rr.rb
36
- - lib/rr/scenario_method_proxy.rb
37
- - lib/rr/scenario.rb
38
- - lib/rr/scenario_definition.rb
39
- - lib/rr/hash_with_object_id_key.rb
40
- - lib/rr/scenario_definition_builder.rb
41
- - lib/rr/scenario_matches.rb
42
- - lib/rr/space.rb
43
- - lib/rr/double.rb
44
- - lib/rr/scenario_creator.rb
45
- - lib/rr/times_called_matchers/any_times_matcher.rb
46
- - lib/rr/times_called_matchers/at_most_matcher.rb
47
- - lib/rr/times_called_matchers/times_called_matcher.rb
48
- - lib/rr/times_called_matchers/at_least_matcher.rb
49
- - lib/rr/times_called_matchers/proc_matcher.rb
50
- - lib/rr/times_called_matchers/integer_matcher.rb
51
- - lib/rr/times_called_matchers/non_terminal.rb
52
- - lib/rr/times_called_matchers/terminal.rb
53
- - lib/rr/times_called_matchers/range_matcher.rb
35
+ - lib/rr/extensions/instance_methods.rb
36
+ - lib/rr/adapters/test_unit.rb
37
+ - lib/rr/adapters/rspec.rb
54
38
  - lib/rr/expectations/argument_equality_expectation.rb
55
39
  - lib/rr/expectations/times_called_expectation.rb
56
40
  - 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
57
44
  - lib/rr/errors/scenario_not_found_error.rb
58
- - lib/rr/errors/argument_equality_error.rb
59
45
  - lib/rr/errors/scenario_order_error.rb
46
+ - lib/rr/errors/argument_equality_error.rb
60
47
  - lib/rr/errors/rr_error.rb
61
- - lib/rr/errors/times_called_error.rb
62
48
  - lib/rr/errors/scenario_definition_error.rb
63
- - lib/rr/adapters/test_unit.rb
64
- - lib/rr/adapters/rspec.rb
49
+ - lib/rr/scenario_creator.rb
50
+ - lib/rr/space.rb
51
+ - lib/rr/scenario_definition_builder.rb
52
+ - lib/rr/scenario_definition.rb
65
53
  - lib/rr/wildcard_matchers/boolean.rb
54
+ - lib/rr/wildcard_matchers/anything.rb
55
+ - lib/rr/wildcard_matchers/numeric.rb
66
56
  - lib/rr/wildcard_matchers/duck_type.rb
67
- - lib/rr/wildcard_matchers/range.rb
68
57
  - lib/rr/wildcard_matchers/regexp.rb
69
- - lib/rr/wildcard_matchers/numeric.rb
70
58
  - lib/rr/wildcard_matchers/is_a.rb
71
- - lib/rr/wildcard_matchers/anything.rb
72
- - lib/rr/extensions/instance_methods.rb
73
- - examples/environment_fixture_setup.rb
74
- - examples/rspec_example_suite.rb
75
- - examples/example_suite.rb
76
- - examples/example_helper.rb
77
- - examples/test_unit_example_suite.rb
78
- - examples/high_level_example.rb
79
- - examples/rr/scenario_definition_example.rb
80
- - examples/rr/scenario_method_proxy_example.rb
81
- - examples/rr/scenario_example.rb
82
- - examples/rr/scenario_creator_example.rb
83
- - examples/rr/rspec/rspec_backtrace_tweaking_example.rb
84
- - examples/rr/rspec/rspec_adapter_example.rb
85
- - examples/rr/rspec/rspec_usage_example.rb
86
- - examples/rr/times_called_matchers/at_most_matcher_example.rb
87
- - examples/rr/times_called_matchers/at_least_matcher_example.rb
88
- - examples/rr/times_called_matchers/times_called_matcher_example.rb
89
- - examples/rr/times_called_matchers/range_matcher_example.rb
90
- - examples/rr/times_called_matchers/proc_matcher_example.rb
91
- - examples/rr/times_called_matchers/any_times_matcher_example.rb
92
- - examples/rr/times_called_matchers/integer_matcher_example.rb
93
- - examples/rr/space/space_verify_example.rb
94
- - examples/rr/space/space_reset_example.rb
95
- - examples/rr/space/space_create_example.rb
96
- - examples/rr/space/space_helper.rb
97
- - examples/rr/space/space_example.rb
98
- - examples/rr/space/hash_with_object_id_key_example.rb
99
- - examples/rr/space/space_register_example.rb
100
- - examples/rr/expectations/is_a_argument_equality_expectation_example.rb
101
- - examples/rr/expectations/any_argument_expectation_example.rb
102
- - examples/rr/expectations/regexp_argument_equality_expectation_example.rb
103
- - examples/rr/expectations/boolean_argument_equality_expectation_example.rb
104
- - examples/rr/expectations/duck_type_argument_equality_expectation_example.rb
105
- - examples/rr/expectations/numeric_argument_equality_expectation_example.rb
106
- - examples/rr/expectations/range_argument_equality_expectation_example.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
107
78
  - examples/rr/expectations/argument_equality_expectation_example.rb
108
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
109
82
  - examples/rr/expectations/times_called_expectation/times_called_expectation_integer_example.rb
110
- - examples/rr/expectations/times_called_expectation/times_called_expectation_any_times_example.rb
111
- - examples/rr/expectations/times_called_expectation/times_called_expectation_helper.rb
112
- - examples/rr/expectations/times_called_expectation/times_called_expectation_proc_example.rb
113
83
  - examples/rr/expectations/times_called_expectation/times_called_expectation_example.rb
114
- - examples/rr/expectations/times_called_expectation/times_called_expectation_at_least_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
115
86
  - examples/rr/expectations/times_called_expectation/times_called_expectation_at_most_example.rb
116
- - examples/rr/expectations/times_called_expectation/times_called_expectation_range_example.rb
117
- - examples/rr/errors/rr_error_example.rb
118
- - examples/rr/double/double_reset_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
119
102
  - examples/rr/double/double_bind_example.rb
120
- - examples/rr/double/double_register_scenario_example.rb
121
- - examples/rr/double/double_example.rb
122
103
  - examples/rr/double/double_dispatching_example.rb
104
+ - examples/rr/double/double_example.rb
105
+ - examples/rr/double/double_reset_example.rb
123
106
  - examples/rr/double/double_verify_example.rb
124
- - examples/rr/test_unit/test_unit_backtrace_test.rb
125
- - examples/rr/test_unit/test_helper.rb
126
- - examples/rr/test_unit/test_unit_integration_test.rb
127
- - examples/rr/extensions/instance_methods_argument_matcher_example.rb
128
- - examples/rr/extensions/instance_methods_times_matcher_example.rb
129
- - examples/rr/extensions/instance_methods_creator_example.rb
130
- - examples/rr/extensions/instance_methods_space_example.rb
131
- - examples/rr/extensions/instance_methods_example_helper.rb
107
+ - examples/rr/double/double_register_scenario_example.rb
108
+ - examples/rr/double/double_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
132
133
  test_files: []
133
134
 
134
135
  rdoc_options: