eetee 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eetee/assertion_wrapper.rb +7 -7
- data/lib/eetee/version.rb +1 -1
- data/specs/unit/assertion_wrapper_spec.rb +10 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 490ebe9116eabdb5793ae2348327d840d593ba2d
|
4
|
+
data.tar.gz: 14f9bd2c7fad97bff8216697b6e430d8a04ad674
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e379722726d5df42376728dbf32160258dc415a5641e1cb254173e93ec72eaf0d26175d4677c72808b451af004afabf254ce1301cec6684b34af59e649b43c1b
|
7
|
+
data.tar.gz: 3ee1019f50b7521d4b82fa199d25455e24b39869064b7061debf4001664873684afa9fec5253bbe7c6fe8acecf9bcb068c61f231fc46088ba023486d170645be
|
@@ -13,23 +13,23 @@ module EEtee
|
|
13
13
|
|
14
14
|
end
|
15
15
|
|
16
|
-
def raise(
|
16
|
+
def raise(expected_error_class = RuntimeError)
|
17
17
|
@object.should.be_a ::Proc
|
18
|
-
|
19
18
|
err = nil
|
20
19
|
begin
|
21
|
-
|
20
|
+
@object.call()
|
22
21
|
rescue => ex
|
23
22
|
err = ex
|
24
23
|
end
|
25
24
|
|
26
|
-
|
25
|
+
error_message = err ? err.message : ""
|
26
|
+
fail_message = err ? "#{err.class} (#{error_message})" : "no error"
|
27
27
|
|
28
28
|
invert_helper(
|
29
|
-
"expected to raise #{
|
30
|
-
"expected not to raise #{
|
29
|
+
"expected to raise #{expected_error_class}, got #{fail_message}",
|
30
|
+
"expected not to raise #{expected_error_class} (#{error_message})"
|
31
31
|
) do
|
32
|
-
err.class.should ==
|
32
|
+
err.class.should == expected_error_class
|
33
33
|
end
|
34
34
|
|
35
35
|
err
|
data/lib/eetee/version.rb
CHANGED
@@ -21,6 +21,7 @@ module Helpers
|
|
21
21
|
end
|
22
22
|
|
23
23
|
ret.class.should == error_class
|
24
|
+
ret
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
@@ -75,6 +76,15 @@ describe 'AssertionWrapper' do
|
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
79
|
+
should 'raise an error if block raises no errors' do
|
80
|
+
@obj.expects(:to_zebra).returns(2)
|
81
|
+
err = ensure_error_raised(EEtee::AssertionFailed) do
|
82
|
+
->{ @wrapper.to_zebra }.should.raise(ArgumentError)
|
83
|
+
end
|
84
|
+
|
85
|
+
err.message.should == "expected to raise ArgumentError, got no error"
|
86
|
+
end
|
87
|
+
|
78
88
|
should 'not raise an error if block raises expected error' do
|
79
89
|
@obj.expects(:to_zebra).raises("damn !")
|
80
90
|
ensure_error_not_raised do
|