expectations 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/expectations/expectation.rb +3 -2
- data/lib/expectations/mocha.rb +4 -0
- data/lib/expectations/suite_results.rb +2 -1
- data/rakefile.rb +1 -1
- data/test/sample_expectations_test.rb +2 -14
- metadata +2 -2
@@ -14,6 +14,8 @@ class Expectations::Expectation
|
|
14
14
|
def behavior_based_execute
|
15
15
|
begin
|
16
16
|
mock = expected.instance_variable_get(:@mock)
|
17
|
+
mock.expectations.expectations.clear
|
18
|
+
mock.add_expectation(expected)
|
17
19
|
mocha_setup
|
18
20
|
instance_exec mock, &block
|
19
21
|
mock.verify
|
@@ -23,8 +25,7 @@ class Expectations::Expectation
|
|
23
25
|
self.message = ex.message
|
24
26
|
rescue Exception => ex
|
25
27
|
self.extend(Expectations::Results::BehaviorBasedError)
|
26
|
-
self.exception = ex
|
27
|
-
self.message = ""
|
28
|
+
self.exception = ex
|
28
29
|
ensure
|
29
30
|
mocha_teardown
|
30
31
|
end
|
data/lib/expectations/mocha.rb
CHANGED
@@ -43,7 +43,8 @@ class Expectations::SuiteResults
|
|
43
43
|
out.puts "file <#{error.file}>"
|
44
44
|
out.puts "line <#{error.line}>"
|
45
45
|
out.puts "error <#{error.exception.message}>"
|
46
|
-
out.puts "#{error.message}
|
46
|
+
out.puts "#{error.message}" if error.message.any?
|
47
|
+
out.puts "\n"
|
47
48
|
end
|
48
49
|
out.puts "\n--Failures--" if failures.any?
|
49
50
|
failures.each do |failure|
|
data/rakefile.rb
CHANGED
@@ -41,7 +41,7 @@ specification = Gem::Specification.new do |s|
|
|
41
41
|
expect NoMethodError do
|
42
42
|
Object.invalid_method_call
|
43
43
|
end."
|
44
|
-
s.version = "0.0.
|
44
|
+
s.version = "0.0.5"
|
45
45
|
s.author = 'Jay Fields'
|
46
46
|
s.description = "A lightweight unit testing framework. Tests (expectations) will be written as follows
|
47
47
|
expect 2 do
|
@@ -19,20 +19,8 @@ Expectations do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
# Behavior based test on a concrete mock
|
22
|
-
expect Object.to_receive(:deal)
|
23
|
-
Object.deal
|
22
|
+
expect Object.to_receive(:deal) do
|
23
|
+
Object.deal
|
24
24
|
end
|
25
25
|
|
26
|
-
# expect Object.to_receive(:deal).with(1) do
|
27
|
-
# Object.deals(1)
|
28
|
-
# end
|
29
|
-
#
|
30
|
-
# expect Object.to_receive(:deal).with(1) do
|
31
|
-
# Object.deal(2)
|
32
|
-
# end
|
33
|
-
#
|
34
|
-
# expect Object.to_receive(:deal).with(1) do
|
35
|
-
# Object.deal(1)
|
36
|
-
# end
|
37
|
-
|
38
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expectations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Fields
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2007-12-
|
12
|
+
date: 2007-12-28 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|