assertions 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ === 1.4.0 / 2008-06-27
2
+ Add an Test::Unit::Assertions#assert_not method that verifies that a value is
3
+ false or nil (opposite of the Test::Unit::Assertions#assert method).
4
+
1
5
  === 1.3.0 / 2008-06-25
2
6
  Include an example program.
3
7
 
data/README.txt CHANGED
@@ -6,14 +6,18 @@
6
6
  This package adds some additional assertions to Test::Unit::Assertions,
7
7
  including:
8
8
  * Assertions for all of the comparison operators
9
- (assert_greater_than, assert_less_than_or_equal_to,
10
- etc.). Shorter aliases also are provided for these (assert_gt,
11
- assert_le, etc.).
9
+ (Test::Unit::Assertions#assert_greater_than,
10
+ Test::Unit::Assertions#assert_less_than_or_equal_to,
11
+ etc.). Shorter aliases also are provided for these
12
+ (Test::Unit::Assertions#assert_gt, Test::Unit::Assertions#assert_le, etc.).
12
13
  * An assertion that verifies that a given block raises a specified exception
13
- with a specified message (assert_raise_message).
14
+ with a specified message (Test::Unit::Assertions#assert_raise_message).
14
15
  This allows full testing of error messages.
15
16
  * An assertion that verifies that a given block contains an assertion that
16
- fails (assert_fail), which can be used to test new assertions.
17
+ fails (Test::Unit::Assertions#assert_fail), which can be used to test new
18
+ assertions.
19
+ * An assertion that verifies that a given value is false or nil
20
+ (Test::Unit::Assertions#assert_not)
17
21
 
18
22
  == PROBLEMS:
19
23
  None (known).
@@ -28,6 +32,11 @@ None (known).
28
32
 
29
33
  class Tests < Test::Unit::TestCase
30
34
  def test_assertions
35
+ #
36
+ # Verify that 4 > 5 is false.
37
+ #
38
+ assert_not(4 > 5)
39
+
31
40
  #
32
41
  # Verify that 4 < 5
33
42
  #
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'hoe'
7
7
 
8
8
  $stderr = STDERR
9
9
 
10
- Hoe.new('assertions', "1.3.0") do |p|
10
+ Hoe.new('assertions', "1.4.0") do |p|
11
11
  p.remote_rdoc_dir = ''
12
12
  p.developer('DesigningPatterns', 'technical.inquiries@designingpatterns.com')
13
13
  end
@@ -6,6 +6,11 @@ require 'test/unit'
6
6
 
7
7
  class Tests < Test::Unit::TestCase
8
8
  def test_assertions
9
+ #
10
+ # Verify that 4 > 5 is false.
11
+ #
12
+ assert_not(4 > 5)
13
+
9
14
  #
10
15
  # Verify that 4 < 5
11
16
  #
@@ -48,6 +48,29 @@ module Assertions
48
48
  end
49
49
  end
50
50
 
51
+ #
52
+ # ====Description:
53
+ # This assertion passes if and only if boolean is false or nil.
54
+ #
55
+ # ====Parameters:
56
+ # [boolean]
57
+ # This must be false or nil or the assertion to pass
58
+ # [message = ""]
59
+ # An optional additional message that will be displayed if the
60
+ # assertion fails.
61
+ #
62
+ def assert_not(boolean, message = "")
63
+ _wrap_assertion do
64
+ full_message = build_message(message,
65
+ "<?> incorrectly is true.",
66
+ boolean)
67
+
68
+ assert_block(full_message) do
69
+ !boolean
70
+ end
71
+ end
72
+ end
73
+
51
74
  #
52
75
  # ====Description:
53
76
  # This is a convenience wrapper around assert_operator. It asserts that
@@ -31,6 +31,19 @@ class AssertionsTest < Test::Unit::TestCase
31
31
  end
32
32
  end
33
33
 
34
+ def test_assert_not
35
+ assert_not(false)
36
+ assert_not(nil)
37
+
38
+ assert_fail do
39
+ assert_not(true)
40
+ end
41
+
42
+ assert_fail do
43
+ assert_not(5)
44
+ end
45
+ end
46
+
34
47
  def test_assert_greater_than
35
48
  assert_greater_than(5, 4)
36
49
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assertions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DesigningPatterns
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-26 00:00:00 -04:00
12
+ date: 2008-06-28 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,7 +22,7 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 1.6.0
24
24
  version:
25
- description: "This package adds some additional assertions to Test::Unit::Assertions, including: * Assertions for all of the comparison operators (assert_greater_than, assert_less_than_or_equal_to, etc.). Shorter aliases also are provided for these (assert_gt, assert_le, etc.). * An assertion that verifies that a given block raises a specified exception with a specified message (assert_raise_message). This allows full testing of error messages. * An assertion that verifies that a given block contains an assertion that fails (assert_fail), which can be used to test new assertions."
25
+ description: "This package adds some additional assertions to Test::Unit::Assertions, including: * Assertions for all of the comparison operators (Test::Unit::Assertions#assert_greater_than, Test::Unit::Assertions#assert_less_than_or_equal_to, etc.). Shorter aliases also are provided for these (Test::Unit::Assertions#assert_gt, Test::Unit::Assertions#assert_le, etc.). * An assertion that verifies that a given block raises a specified exception with a specified message (Test::Unit::Assertions#assert_raise_message). This allows full testing of error messages. * An assertion that verifies that a given block contains an assertion that fails (Test::Unit::Assertions#assert_fail), which can be used to test new assertions. * An assertion that verifies that a given value is false or nil (Test::Unit::Assertions#assert_not)"
26
26
  email:
27
27
  - technical.inquiries@designingpatterns.com
28
28
  executables: []
@@ -68,6 +68,6 @@ rubyforge_project: assertions
68
68
  rubygems_version: 1.2.0
69
69
  signing_key:
70
70
  specification_version: 2
71
- summary: "This package adds some additional assertions to Test::Unit::Assertions, including: * Assertions for all of the comparison operators (assert_greater_than, assert_less_than_or_equal_to, etc.)"
71
+ summary: "This package adds some additional assertions to Test::Unit::Assertions, including: * Assertions for all of the comparison operators (Test::Unit::Assertions#assert_greater_than, Test::Unit::Assertions#assert_less_than_or_equal_to, etc.)"
72
72
  test_files:
73
73
  - test/test_assertions.rb