protest 0.4.0 → 0.4.1
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/README.rdoc +10 -6
- data/lib/protest.rb +1 -1
- data/lib/protest/test_case.rb +17 -10
- data/protest.gemspec +2 -2
- metadata +3 -6
data/README.rdoc
CHANGED
@@ -117,13 +117,17 @@ Or you can call the +pending+ method from inside your test.
|
|
117
117
|
|
118
118
|
== Custom assertions
|
119
119
|
|
120
|
-
|
121
|
-
|
120
|
+
Previous versions of Protest used to bundle all the assertions defined in
|
121
|
+
Test::Unit, but that has changed and now Protest includes just three basic
|
122
|
+
assertion methods:
|
122
123
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
124
|
+
- assert
|
125
|
+
- assert_equal
|
126
|
+
- assert_raise
|
127
|
+
|
128
|
+
If you want to add assertions, just define methods that rely on +assert+.
|
129
|
+
This method takes a boolean and an optional error message as arguments, and
|
130
|
+
the assertion is considered to fail if the boolean evaluates to neither
|
127
131
|
+false+ nor +nil+.
|
128
132
|
|
129
133
|
For example:
|
data/lib/protest.rb
CHANGED
data/lib/protest/test_case.rb
CHANGED
@@ -25,12 +25,6 @@ module Protest
|
|
25
25
|
# your tests by declaring nested contexts inside the class. See
|
26
26
|
# TestCase.context.
|
27
27
|
class TestCase
|
28
|
-
begin
|
29
|
-
require "test/unit/assertions"
|
30
|
-
include Test::Unit::Assertions
|
31
|
-
rescue LoadError
|
32
|
-
end
|
33
|
-
|
34
28
|
# Run all tests in this context. Takes a Runner instance in order to
|
35
29
|
# provide output.
|
36
30
|
def self.run(runner)
|
@@ -182,10 +176,23 @@ module Protest
|
|
182
176
|
raise AssertionFailed, message unless condition
|
183
177
|
end
|
184
178
|
|
185
|
-
#
|
186
|
-
#
|
187
|
-
def
|
188
|
-
assert
|
179
|
+
# Passes if expected == actual. You can override the default
|
180
|
+
# failure message by passing it as an argument.
|
181
|
+
def assert_equal(expected, actual, message=nil)
|
182
|
+
assert expected == actual, message || "#{expected.inspect} expected but was #{actual.inspect}"
|
183
|
+
end
|
184
|
+
|
185
|
+
# Passes if the code block raises the specified exception. If no
|
186
|
+
# exception is specified, passes if any exception is raised,
|
187
|
+
# otherwise it fails. You can override the default failure message
|
188
|
+
# by passing it as an argument.
|
189
|
+
def assert_raise(exception_class=Exception, message=nil)
|
190
|
+
begin
|
191
|
+
yield
|
192
|
+
rescue exception_class => e
|
193
|
+
ensure
|
194
|
+
assert e, message || "Expected #{exception_class.name} to be raised"
|
195
|
+
end
|
189
196
|
end
|
190
197
|
|
191
198
|
# Make the test be ignored as pending. You can override the default message
|
data/protest.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = "protest"
|
4
|
-
s.version = "0.4.
|
5
|
-
s.date = "2010-09-
|
4
|
+
s.version = "0.4.1"
|
5
|
+
s.date = "2010-09-13"
|
6
6
|
|
7
7
|
s.description = "Protest is a tiny, simple, and easy-to-extend test framework"
|
8
8
|
s.summary = s.description
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 15
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
8
|
+
- 1
|
9
|
+
version: 0.4.1
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- "Nicol\xC3\xA1s Sanguinetti"
|
@@ -16,7 +15,7 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-13 00:00:00 -03:00
|
20
19
|
default_executable:
|
21
20
|
dependencies: []
|
22
21
|
|
@@ -65,7 +64,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
64
|
requirements:
|
66
65
|
- - ">="
|
67
66
|
- !ruby/object:Gem::Version
|
68
|
-
hash: 3
|
69
67
|
segments:
|
70
68
|
- 0
|
71
69
|
version: "0"
|
@@ -74,7 +72,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
72
|
requirements:
|
75
73
|
- - ">="
|
76
74
|
- !ruby/object:Gem::Version
|
77
|
-
hash: 3
|
78
75
|
segments:
|
79
76
|
- 0
|
80
77
|
version: "0"
|