rr 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
* 0.1.5
|
2
|
+
- TimesCalledExpectation says how many times were called and how many times called were expected on error
|
3
|
+
|
1
4
|
* 0.1.4
|
2
5
|
- TimesCalledError prints the backtrace to where the Scenario was defined when being verified
|
3
6
|
- Error message includes method name when Scenario is not found
|
data/Rakefile
CHANGED
@@ -77,7 +77,10 @@ describe TimesCalledExpectation, "#verify! when passed an Integer (2)" do
|
|
77
77
|
|
78
78
|
it "fails after verify_input called 1 time" do
|
79
79
|
@expectation.verify_input
|
80
|
-
proc {@expectation.verify!}.should raise_error(
|
80
|
+
proc {@expectation.verify!}.should raise_error(
|
81
|
+
Errors::TimesCalledError,
|
82
|
+
"Called 1 time. Expected 2."
|
83
|
+
)
|
81
84
|
end
|
82
85
|
|
83
86
|
it "can't be called when verify_input is called 3 times" do
|
@@ -85,7 +88,7 @@ describe TimesCalledExpectation, "#verify! when passed an Integer (2)" do
|
|
85
88
|
@expectation.verify_input
|
86
89
|
proc do
|
87
90
|
@expectation.verify_input
|
88
|
-
end.should raise_error(Errors::TimesCalledError)
|
91
|
+
end.should raise_error(Errors::TimesCalledError, "Called 3 times. Expected 2.")
|
89
92
|
end
|
90
93
|
|
91
94
|
it "has a backtrace to where the TimesCalledExpectation was instantiated on failure" do
|
@@ -98,6 +101,12 @@ describe TimesCalledExpectation, "#verify! when passed an Integer (2)" do
|
|
98
101
|
e.backtrace.first.should include(__FILE__)
|
99
102
|
e.backtrace.first.should include(":#{@expected_line}")
|
100
103
|
end
|
104
|
+
|
105
|
+
it "has an error message that includes the number of times called and expected number of times" do
|
106
|
+
proc do
|
107
|
+
@expectation.verify!
|
108
|
+
end.should raise_error(Errors::TimesCalledError, "Called 0 times. Expected 2.")
|
109
|
+
end
|
101
110
|
end
|
102
111
|
|
103
112
|
describe TimesCalledExpectation, "#verify! when passed a Range (1..2)" do
|
@@ -123,7 +132,7 @@ describe TimesCalledExpectation, "#verify! when passed a Range (1..2)" do
|
|
123
132
|
@expectation.verify_input
|
124
133
|
proc do
|
125
134
|
@expectation.verify_input
|
126
|
-
end.should raise_error(Errors::TimesCalledError)
|
135
|
+
end.should raise_error(Errors::TimesCalledError, "Called 3 times. Expected 1..2.")
|
127
136
|
end
|
128
137
|
end
|
129
138
|
|
@@ -27,18 +27,23 @@ module RR
|
|
27
27
|
def verify!
|
28
28
|
unless verify
|
29
29
|
if @verify_backtrace
|
30
|
-
error = Errors::TimesCalledError.new
|
30
|
+
error = Errors::TimesCalledError.new(error_message)
|
31
31
|
error.backtrace = @verify_backtrace
|
32
32
|
raise error
|
33
33
|
else
|
34
|
-
raise Errors::TimesCalledError
|
34
|
+
raise Errors::TimesCalledError, error_message
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
protected
|
40
40
|
def verify_input_error
|
41
|
-
raise Errors::TimesCalledError,
|
41
|
+
raise Errors::TimesCalledError, error_message
|
42
|
+
end
|
43
|
+
|
44
|
+
def error_message
|
45
|
+
time_casing = (@times_called == 1) ? "time" : "times"
|
46
|
+
"Called #{@times_called.inspect} #{time_casing}. Expected #{@times.inspect}."
|
42
47
|
end
|
43
48
|
end
|
44
49
|
end
|
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.3
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rr
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
6
|
+
version: 0.1.5
|
7
7
|
date: 2007-07-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:
|