assay 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/.ruby +46 -41
  2. data/COPYING.rdoc +38 -0
  3. data/HISTORY.rdoc +18 -1
  4. data/QED.rdoc +1100 -0
  5. data/README.rdoc +139 -16
  6. data/lib/assay.rb +82 -29
  7. data/lib/assay.yml +46 -41
  8. data/lib/assay/{adapters → adapter}/minitest.rb +0 -0
  9. data/lib/assay/{adapters → adapter}/testunit.rb +0 -0
  10. data/lib/assay/assertable.rb +174 -0
  11. data/lib/assay/assertion.rb +98 -124
  12. data/lib/assay/assertor.rb +187 -0
  13. data/lib/assay/boolean_assay.rb +15 -0
  14. data/lib/assay/case_assay.rb +17 -0
  15. data/lib/assay/compare_assay.rb +38 -0
  16. data/lib/assay/core_ext/kernel.rb +52 -0
  17. data/lib/assay/core_ext/na.rb +9 -0
  18. data/lib/assay/directory_assay.rb +20 -0
  19. data/lib/assay/empty_assay.rb +17 -0
  20. data/lib/assay/equal_assay.rb +35 -0
  21. data/lib/assay/equality_assay.rb +18 -0
  22. data/lib/assay/execution_assay.rb +59 -0
  23. data/lib/assay/false_assay.rb +17 -0
  24. data/lib/assay/file_assay.rb +17 -0
  25. data/lib/assay/identity_assay.rb +49 -0
  26. data/lib/assay/include_assay.rb +17 -0
  27. data/lib/assay/instance_assay.rb +17 -0
  28. data/lib/assay/kind_assay.rb +18 -0
  29. data/lib/assay/less_assay.rb +18 -0
  30. data/lib/assay/less_equal_assay.rb +25 -0
  31. data/lib/assay/like_assay.rb +17 -0
  32. data/lib/assay/match_assay.rb +17 -0
  33. data/lib/assay/more_assay.rb +18 -0
  34. data/lib/assay/more_equal_assay.rb +25 -0
  35. data/lib/assay/nil_assay.rb +15 -0
  36. data/lib/assay/nomatch_assay.rb +17 -0
  37. data/lib/assay/output_assay.rb +35 -0
  38. data/lib/assay/path_assay.rb +17 -0
  39. data/lib/assay/raise_assay.rb +109 -0
  40. data/lib/assay/rescue_assay.rb +55 -0
  41. data/lib/assay/respond_assay.rb +17 -0
  42. data/lib/assay/return_assay.rb +46 -0
  43. data/lib/assay/silent_assay.rb +59 -0
  44. data/lib/assay/stderr_assay.rb +30 -0
  45. data/lib/assay/stdout_assay.rb +30 -0
  46. data/lib/assay/throw_assay.rb +89 -0
  47. data/lib/assay/true_assay.rb +20 -0
  48. data/lib/assay/unequal_assay.rb +37 -0
  49. data/lib/assay/within_assay.rb +39 -0
  50. data/test/case_compare_assay.rb +59 -0
  51. data/test/case_empty_assay.rb +51 -0
  52. data/test/case_equal_assay.rb +53 -0
  53. data/test/case_equality_assay.rb +55 -0
  54. data/test/case_false_assay.rb +48 -0
  55. data/test/case_identity_assay.rb +51 -0
  56. data/test/case_include_assay.rb +51 -0
  57. data/test/case_instance_assay.rb +51 -0
  58. data/test/case_kind_assay.rb +51 -0
  59. data/test/case_less_assay.rb +53 -0
  60. data/test/case_less_equal_assay.rb +53 -0
  61. data/test/case_like_assay.rb +57 -0
  62. data/test/case_match_assay.rb +45 -0
  63. data/test/case_more_assay.rb +53 -0
  64. data/test/case_more_equal_assay.rb +53 -0
  65. data/test/case_nil_assay.rb +48 -0
  66. data/test/case_nomatch_assay.rb +47 -0
  67. data/test/case_raise_assay.rb +51 -0
  68. data/test/case_respond_assay.rb +51 -0
  69. data/test/case_throw_assay.rb +51 -0
  70. data/test/case_true_assay.rb +48 -0
  71. data/test/case_unequal_assay.rb +55 -0
  72. data/test/case_within_assay.rb +61 -0
  73. data/test/helper.rb +36 -0
  74. metadata +135 -108
  75. data/APACHE2.txt +0 -205
  76. data/NOTICE.rdoc +0 -18
  77. data/lib/assay/assertions/compare_failure.rb +0 -61
  78. data/lib/assay/assertions/delta_failure.rb +0 -80
  79. data/lib/assay/assertions/empty_failure.rb +0 -76
  80. data/lib/assay/assertions/equality_failure.rb +0 -100
  81. data/lib/assay/assertions/execution_failure.rb +0 -90
  82. data/lib/assay/assertions/false_failure.rb +0 -72
  83. data/lib/assay/assertions/identity_failure.rb +0 -85
  84. data/lib/assay/assertions/instance_failure.rb +0 -76
  85. data/lib/assay/assertions/kind_failure.rb +0 -80
  86. data/lib/assay/assertions/match_failure.rb +0 -85
  87. data/lib/assay/assertions/nil_failure.rb +0 -75
  88. data/lib/assay/assertions/raise_failure.rb +0 -134
  89. data/lib/assay/assertions/response_failure.rb +0 -86
  90. data/lib/assay/assertions/same_failure.rb +0 -82
  91. data/lib/assay/assertions/throw_failure.rb +0 -122
  92. data/lib/assay/assertions/true_failure.rb +0 -79
  93. data/lib/assay/matcher.rb +0 -48
  94. data/qed/01_failure_classes.rdoc +0 -75
  95. data/qed/02_assertives.rdoc +0 -118
  96. data/qed/03_matchers.rdoc +0 -118
  97. data/qed/04_lookup.rdoc +0 -10
@@ -0,0 +1,48 @@
1
+ covers 'assay/false_assay'
2
+
3
+ testcase FalseAssay do
4
+
5
+ class_method :pass? do
6
+ test do
7
+ assert FalseAssay.pass?(false)
8
+ refute FalseAssay.pass?(true)
9
+ refute FalseAssay.pass?(nil)
10
+ refute FalseAssay.pass?(:foobar)
11
+ end
12
+ end
13
+
14
+ class_method :fail? do
15
+ test do
16
+ refute FalseAssay.fail?(false)
17
+ assert FalseAssay.fail?(true)
18
+ assert FalseAssay.fail?(nil)
19
+ assert FalseAssay.fail?(:foobar)
20
+ end
21
+ end
22
+
23
+ class_method :assert! do
24
+ test do
25
+ FalseAssay.assert!(false)
26
+ end
27
+
28
+ test do
29
+ expect FalseAssay do
30
+ FalseAssay.assert!(nil)
31
+ end
32
+ end
33
+ end
34
+
35
+ class_method :refute! do
36
+ test do
37
+ FalseAssay.refute!(true)
38
+ FalseAssay.refute!(nil)
39
+ end
40
+
41
+ test do
42
+ expect FalseAssay do
43
+ FalseAssay.refute!(false)
44
+ end
45
+ end
46
+ end
47
+
48
+ end
@@ -0,0 +1,51 @@
1
+ covers 'assay/identity_assay'
2
+
3
+ testcase IdentityAssay do
4
+
5
+ class_method :pass? do
6
+
7
+ test do
8
+ assert IdentityAssay.pass?(1,1)
9
+ refute IdentityAssay.pass?(1,2)
10
+ end
11
+
12
+ end
13
+
14
+ class_method :fail? do
15
+
16
+ test do
17
+ refute IdentityAssay.fail?(1,1)
18
+ assert IdentityAssay.fail?(1,2)
19
+ end
20
+
21
+ end
22
+
23
+ class_method :assert! do
24
+
25
+ test do
26
+ IdentityAssay.assert!(1,1)
27
+ end
28
+
29
+ test do
30
+ expect IdentityAssay do
31
+ IdentityAssay.assert!(1,2)
32
+ end
33
+ end
34
+
35
+ end
36
+
37
+ class_method :refute! do
38
+
39
+ test do
40
+ IdentityAssay.refute!(1,2)
41
+ end
42
+
43
+ test do
44
+ expect IdentityAssay do
45
+ IdentityAssay.refute!(1,1)
46
+ end
47
+ end
48
+
49
+ end
50
+
51
+ end
@@ -0,0 +1,51 @@
1
+ covers 'assay/include_assay'
2
+
3
+ testcase IncludeAssay do
4
+
5
+ class_method :pass? do
6
+
7
+ test do
8
+ assert IncludeAssay.pass?([1], 1)
9
+ refute IncludeAssay.pass?([1], 2)
10
+ end
11
+
12
+ end
13
+
14
+ class_method :fail? do
15
+
16
+ test do
17
+ refute IncludeAssay.fail?([1], 1)
18
+ assert IncludeAssay.fail?([1], 2)
19
+ end
20
+
21
+ end
22
+
23
+ class_method :assert! do
24
+
25
+ test do
26
+ IncludeAssay.assert!([1], 1)
27
+ end
28
+
29
+ test do
30
+ expect IncludeAssay do
31
+ IncludeAssay.assert!([1], 2)
32
+ end
33
+ end
34
+
35
+ end
36
+
37
+ class_method :refute! do
38
+
39
+ test do
40
+ IncludeAssay.refute!([1], 2)
41
+ end
42
+
43
+ test do
44
+ expect IncludeAssay do
45
+ IncludeAssay.refute!([1], 1)
46
+ end
47
+ end
48
+
49
+ end
50
+
51
+ end
@@ -0,0 +1,51 @@
1
+ covers 'assay/instance_assay'
2
+
3
+ testcase InstanceAssay do
4
+
5
+ class_method :pass? do
6
+
7
+ test do
8
+ assert InstanceAssay.pass?(1,Fixnum)
9
+ refute InstanceAssay.pass?(1,Integer)
10
+ end
11
+
12
+ end
13
+
14
+ class_method :fail? do
15
+
16
+ test do
17
+ refute InstanceAssay.fail?(1,Fixnum)
18
+ assert InstanceAssay.fail?(1,String)
19
+ end
20
+
21
+ end
22
+
23
+ class_method :assert! do
24
+
25
+ test do
26
+ InstanceAssay.assert!(1,Fixnum)
27
+ end
28
+
29
+ test do
30
+ expect InstanceAssay do
31
+ InstanceAssay.assert!(1,Symbol)
32
+ end
33
+ end
34
+
35
+ end
36
+
37
+ class_method :refute! do
38
+
39
+ test do
40
+ InstanceAssay.refute!(1,Numeric)
41
+ end
42
+
43
+ test do
44
+ expect InstanceAssay do
45
+ InstanceAssay.refute!(1,Fixnum)
46
+ end
47
+ end
48
+
49
+ end
50
+
51
+ end
@@ -0,0 +1,51 @@
1
+ covers 'assay/kind_assay'
2
+
3
+ testcase KindAssay do
4
+
5
+ class_method :pass? do
6
+
7
+ test do
8
+ assert KindAssay.pass?(1,Integer)
9
+ refute KindAssay.pass?(1,String)
10
+ end
11
+
12
+ end
13
+
14
+ class_method :fail? do
15
+
16
+ test do
17
+ refute KindAssay.fail?(1,Integer)
18
+ assert KindAssay.fail?(1,String)
19
+ end
20
+
21
+ end
22
+
23
+ class_method :assert! do
24
+
25
+ test do
26
+ KindAssay.assert!(1,Fixnum)
27
+ end
28
+
29
+ test do
30
+ expect KindAssay do
31
+ KindAssay.assert!(1,Symbol)
32
+ end
33
+ end
34
+
35
+ end
36
+
37
+ class_method :refute! do
38
+
39
+ test do
40
+ KindAssay.refute!(1,String)
41
+ end
42
+
43
+ test do
44
+ expect KindAssay do
45
+ KindAssay.refute!(1,Numeric)
46
+ end
47
+ end
48
+
49
+ end
50
+
51
+ end
@@ -0,0 +1,53 @@
1
+ covers 'assay/less_assay'
2
+
3
+ testcase LessAssay do
4
+
5
+ class_method :pass? do
6
+
7
+ test do
8
+ assert LessAssay.pass?(1, 2)
9
+ refute LessAssay.pass?(1, 1)
10
+ refute LessAssay.pass?(2, 1)
11
+ end
12
+
13
+ end
14
+
15
+ class_method :fail? do
16
+
17
+ test do
18
+ refute LessAssay.fail?(1, 2)
19
+ assert LessAssay.fail?(1, 1)
20
+ assert LessAssay.fail?(2, 1)
21
+ end
22
+
23
+ end
24
+
25
+ class_method :assert! do
26
+
27
+ test do
28
+ LessAssay.assert!(1, 2)
29
+ end
30
+
31
+ test do
32
+ expect LessAssay do
33
+ LessAssay.assert!(2, 1)
34
+ end
35
+ end
36
+
37
+ end
38
+
39
+ class_method :refute! do
40
+
41
+ test do
42
+ LessAssay.refute!(2, 1)
43
+ end
44
+
45
+ test do
46
+ expect LessAssay do
47
+ LessAssay.refute!(1, 2)
48
+ end
49
+ end
50
+
51
+ end
52
+
53
+ end
@@ -0,0 +1,53 @@
1
+ covers 'assay/less_equal_assay'
2
+
3
+ testcase LessEqualAssay do
4
+
5
+ class_method :pass? do
6
+
7
+ test do
8
+ assert LessEqualAssay.pass?(1, 2)
9
+ assert LessEqualAssay.pass?(1, 1)
10
+ refute LessEqualAssay.pass?(2, 1)
11
+ end
12
+
13
+ end
14
+
15
+ class_method :fail? do
16
+
17
+ test do
18
+ refute LessEqualAssay.fail?(1, 2)
19
+ refute LessEqualAssay.fail?(1, 1)
20
+ assert LessEqualAssay.fail?(2, 1)
21
+ end
22
+
23
+ end
24
+
25
+ class_method :assert! do
26
+
27
+ test do
28
+ LessEqualAssay.assert!(1, 2)
29
+ end
30
+
31
+ test do
32
+ expect LessEqualAssay do
33
+ LessEqualAssay.assert!(2, 1)
34
+ end
35
+ end
36
+
37
+ end
38
+
39
+ class_method :refute! do
40
+
41
+ test do
42
+ LessEqualAssay.refute!(2, 1)
43
+ end
44
+
45
+ test do
46
+ expect LessEqualAssay do
47
+ LessEqualAssay.refute!(1, 2)
48
+ end
49
+ end
50
+
51
+ end
52
+
53
+ end
@@ -0,0 +1,57 @@
1
+ covers 'assay/like_assay'
2
+
3
+ testcase LikeAssay do
4
+
5
+ class_method :pass? do
6
+
7
+ test do
8
+ assert LikeAssay.pass?(1, 1)
9
+ assert LikeAssay.pass?(1, 1.0)
10
+ assert LikeAssay.pass?(1, Integer)
11
+
12
+ refute LikeAssay.pass?(1, 2)
13
+ end
14
+
15
+ end
16
+
17
+ class_method :fail? do
18
+
19
+ test do
20
+ refute LikeAssay.fail?(1, 1)
21
+ refute LikeAssay.fail?(1, 1.0)
22
+ refute LikeAssay.fail?(1, Integer)
23
+
24
+ assert LikeAssay.fail?(1, 2)
25
+ end
26
+
27
+ end
28
+
29
+ class_method :assert! do
30
+
31
+ test do
32
+ LikeAssay.assert!(1, Numeric)
33
+ end
34
+
35
+ test do
36
+ expect LikeAssay do
37
+ LikeAssay.assert!(1, 2)
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ class_method :refute! do
44
+
45
+ test do
46
+ LikeAssay.refute!(1, 2)
47
+ end
48
+
49
+ test do
50
+ expect LikeAssay do
51
+ LikeAssay.refute!(1, 1)
52
+ end
53
+ end
54
+
55
+ end
56
+
57
+ end
@@ -0,0 +1,45 @@
1
+ covers 'assay/match_assay'
2
+
3
+ testcase MatchAssay do
4
+
5
+ class_method :pass? do
6
+ test do
7
+ assert MatchAssay.pass?('a', /a/)
8
+ refute MatchAssay.pass?('b', /a/)
9
+ refute MatchAssay.pass?('a', /b/)
10
+ end
11
+ end
12
+
13
+ class_method :fail? do
14
+ test do
15
+ refute MatchAssay.fail?('a', /a/)
16
+ assert MatchAssay.fail?('b', /a/)
17
+ assert MatchAssay.fail?('a', /b/)
18
+ end
19
+ end
20
+
21
+ class_method :assert! do
22
+ test do
23
+ MatchAssay.assert!('a', /a/)
24
+ end
25
+
26
+ test do
27
+ expect MatchAssay do
28
+ MatchAssay.assert!('a', /b/)
29
+ end
30
+ end
31
+ end
32
+
33
+ class_method :refute! do
34
+ test do
35
+ MatchAssay.refute!('a', /b/)
36
+ end
37
+
38
+ test do
39
+ expect MatchAssay do
40
+ MatchAssay.refute!('a', /a/)
41
+ end
42
+ end
43
+ end
44
+
45
+ end