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,53 @@
1
+ covers 'assay/more_assay'
2
+
3
+ testcase MoreAssay do
4
+
5
+ class_method :pass? do
6
+
7
+ test do
8
+ assert MoreAssay.pass?(2, 1)
9
+ refute MoreAssay.pass?(1, 1)
10
+ refute MoreAssay.pass?(1, 2)
11
+ end
12
+
13
+ end
14
+
15
+ class_method :fail? do
16
+
17
+ test do
18
+ refute MoreAssay.fail?(2, 1)
19
+ assert MoreAssay.fail?(1, 1)
20
+ assert MoreAssay.fail?(1, 2)
21
+ end
22
+
23
+ end
24
+
25
+ class_method :assert! do
26
+
27
+ test do
28
+ MoreAssay.assert!(2, 1)
29
+ end
30
+
31
+ test do
32
+ expect MoreAssay do
33
+ MoreAssay.assert!(1, 2)
34
+ end
35
+ end
36
+
37
+ end
38
+
39
+ class_method :refute! do
40
+
41
+ test do
42
+ MoreAssay.refute!(1, 2)
43
+ end
44
+
45
+ test do
46
+ expect MoreAssay do
47
+ MoreAssay.refute!(2, 1)
48
+ end
49
+ end
50
+
51
+ end
52
+
53
+ end
@@ -0,0 +1,53 @@
1
+ covers 'assay/more_equal_assay'
2
+
3
+ testcase MoreEqualAssay do
4
+
5
+ class_method :pass? do
6
+
7
+ test do
8
+ assert MoreEqualAssay.pass?(2, 1)
9
+ assert MoreEqualAssay.pass?(1, 1)
10
+ refute MoreEqualAssay.pass?(1, 2)
11
+ end
12
+
13
+ end
14
+
15
+ class_method :fail? do
16
+
17
+ test do
18
+ refute MoreEqualAssay.fail?(2, 1)
19
+ refute MoreEqualAssay.fail?(1, 1)
20
+ assert MoreEqualAssay.fail?(1, 2)
21
+ end
22
+
23
+ end
24
+
25
+ class_method :assert! do
26
+
27
+ test do
28
+ MoreEqualAssay.assert!(2, 1)
29
+ end
30
+
31
+ test do
32
+ expect MoreEqualAssay do
33
+ MoreEqualAssay.assert!(1, 2)
34
+ end
35
+ end
36
+
37
+ end
38
+
39
+ class_method :refute! do
40
+
41
+ test do
42
+ MoreEqualAssay.refute!(1, 2)
43
+ end
44
+
45
+ test do
46
+ expect MoreEqualAssay do
47
+ MoreEqualAssay.refute!(2, 1)
48
+ end
49
+ end
50
+
51
+ end
52
+
53
+ end
@@ -0,0 +1,48 @@
1
+ covers 'assay/nil_assay'
2
+
3
+ testcase NilAssay do
4
+
5
+ class_method :pass? do
6
+ test do
7
+ assert NilAssay.pass?(nil)
8
+ refute NilAssay.pass?(true)
9
+ refute NilAssay.pass?(false)
10
+ refute NilAssay.pass?(:foobar)
11
+ end
12
+ end
13
+
14
+ class_method :fail? do
15
+ test do
16
+ refute NilAssay.fail?(nil)
17
+ assert NilAssay.fail?(true)
18
+ assert NilAssay.fail?(false)
19
+ assert NilAssay.fail?(:foobar)
20
+ end
21
+ end
22
+
23
+ class_method :assert! do
24
+ test do
25
+ NilAssay.assert!(nil)
26
+ end
27
+
28
+ test do
29
+ expect NilAssay do
30
+ NilAssay.assert!(false)
31
+ end
32
+ end
33
+ end
34
+
35
+ class_method :refute! do
36
+ test do
37
+ NilAssay.refute!(true)
38
+ NilAssay.refute!(false)
39
+ end
40
+
41
+ test do
42
+ expect NilAssay do
43
+ NilAssay.refute!(nil)
44
+ end
45
+ end
46
+ end
47
+
48
+ end
@@ -0,0 +1,47 @@
1
+ covers 'assay/nomatch_assay'
2
+
3
+ testcase NoMatchAssay do
4
+
5
+ class_method :pass? do
6
+ test do
7
+ assert NoMatchAssay.pass?('b', /a/)
8
+ assert NoMatchAssay.pass?('a', /b/)
9
+
10
+ refute NoMatchAssay.pass?('a', /a/)
11
+ end
12
+ end
13
+
14
+ class_method :fail? do
15
+ test do
16
+ refute NoMatchAssay.fail?('b', /a/)
17
+ refute NoMatchAssay.fail?('a', /b/)
18
+
19
+ assert NoMatchAssay.fail?('a', /a/)
20
+ end
21
+ end
22
+
23
+ class_method :assert! do
24
+ test do
25
+ NoMatchAssay.assert!('a', /b/)
26
+ end
27
+
28
+ test do
29
+ expect NoMatchAssay do
30
+ NoMatchAssay.assert!('a', /a/)
31
+ end
32
+ end
33
+ end
34
+
35
+ class_method :refute! do
36
+ test do
37
+ NoMatchAssay.refute!('a', /a/)
38
+ end
39
+
40
+ test do
41
+ expect NoMatchAssay do
42
+ NoMatchAssay.refute!('a', /b/)
43
+ end
44
+ end
45
+ end
46
+
47
+ end
@@ -0,0 +1,51 @@
1
+ covers 'assay/raise_assay'
2
+
3
+ testcase RaiseAssay do
4
+
5
+ class_method :pass? do
6
+
7
+ test do
8
+ assert RaiseAssay.pass?(StandardError){ raise }
9
+ refute RaiseAssay.pass?(ArgumentError){ raise }
10
+ end
11
+
12
+ end
13
+
14
+ class_method :fail? do
15
+
16
+ test do
17
+ refute RaiseAssay.fail?(StandardError){ raise }
18
+ assert RaiseAssay.fail?(ArgumentError){ raise }
19
+ end
20
+
21
+ end
22
+
23
+ class_method :assert! do
24
+
25
+ test do
26
+ RaiseAssay.assert!(StandardError){ raise }
27
+ end
28
+
29
+ test do
30
+ expect RaiseAssay do
31
+ RaiseAssay.assert!(ArgumentError){ raise }
32
+ end
33
+ end
34
+
35
+ end
36
+
37
+ class_method :refute! do
38
+
39
+ test do
40
+ RaiseAssay.refute!(ArgumentError){ raise }
41
+ end
42
+
43
+ test do
44
+ expect RaiseAssay do
45
+ RaiseAssay.refute!(StandardError){ raise }
46
+ end
47
+ end
48
+
49
+ end
50
+
51
+ end
@@ -0,0 +1,51 @@
1
+ covers 'assay/respond_assay'
2
+
3
+ testcase RespondAssay do
4
+
5
+ class_method :pass? do
6
+
7
+ test do
8
+ assert RespondAssay.pass?(:symbol, :to_s)
9
+ refute RespondAssay.pass?(:symbol, :no_method)
10
+ end
11
+
12
+ end
13
+
14
+ class_method :fail? do
15
+
16
+ test do
17
+ refute RespondAssay.fail?(:symbol, :to_s)
18
+ assert RespondAssay.fail?(:symbol, :no_method)
19
+ end
20
+
21
+ end
22
+
23
+ class_method :assert! do
24
+
25
+ test do
26
+ RespondAssay.assert!(:symbol, :to_s)
27
+ end
28
+
29
+ test do
30
+ expect RespondAssay do
31
+ RespondAssay.assert!(:symbol, :no_method)
32
+ end
33
+ end
34
+
35
+ end
36
+
37
+ class_method :refute! do
38
+
39
+ test do
40
+ RespondAssay.refute!(:symbol, :no_method)
41
+ end
42
+
43
+ test do
44
+ expect RespondAssay do
45
+ RespondAssay.refute!(:symbol, :to_s)
46
+ end
47
+ end
48
+
49
+ end
50
+
51
+ end
@@ -0,0 +1,51 @@
1
+ covers 'assay/throw_assay'
2
+
3
+ testcase ThrowAssay do
4
+
5
+ class_method :pass? do
6
+
7
+ test do
8
+ assert ThrowAssay.pass?(:foo){ throw :foo }
9
+ refute ThrowAssay.pass?(:foo){ throw :bar }
10
+ end
11
+
12
+ end
13
+
14
+ class_method :fail? do
15
+
16
+ test do
17
+ assert ThrowAssay.fail?(:foo){ throw :bar }
18
+ refute ThrowAssay.fail?(:foo){ throw :foo }
19
+ end
20
+
21
+ end
22
+
23
+ class_method :assert! do
24
+
25
+ test do
26
+ ThrowAssay.assert!(:foo){ throw :foo }
27
+ end
28
+
29
+ test do
30
+ expect ThrowAssay do
31
+ ThrowAssay.assert!(:bar){ throw :foo }
32
+ end
33
+ end
34
+
35
+ end
36
+
37
+ class_method :refute! do
38
+
39
+ test do
40
+ ThrowAssay.refute!(:bar){ throw :foo }
41
+ end
42
+
43
+ test do
44
+ expect ThrowAssay do
45
+ ThrowAssay.refute!(:bar){ throw :bar }
46
+ end
47
+ end
48
+
49
+ end
50
+
51
+ end
@@ -0,0 +1,48 @@
1
+ covers 'assay/true_assay'
2
+
3
+ testcase TrueAssay do
4
+
5
+ class_method :pass? do
6
+ test do
7
+ assert TrueAssay.pass?(true)
8
+ refute TrueAssay.pass?(nil)
9
+ refute TrueAssay.pass?(false)
10
+ refute TrueAssay.pass?(:foobar)
11
+ end
12
+ end
13
+
14
+ class_method :fail? do
15
+ test do
16
+ refute TrueAssay.fail?(true)
17
+ assert TrueAssay.fail?(nil)
18
+ assert TrueAssay.fail?(false)
19
+ assert TrueAssay.fail?(:foobar)
20
+ end
21
+ end
22
+
23
+ class_method :assert! do
24
+ test do
25
+ TrueAssay.assert!(true)
26
+ end
27
+
28
+ test do
29
+ expect TrueAssay do
30
+ TrueAssay.assert!(false)
31
+ end
32
+ end
33
+ end
34
+
35
+ class_method :refute! do
36
+ test do
37
+ TrueAssay.refute!(nil)
38
+ TrueAssay.refute!(false)
39
+ end
40
+
41
+ test do
42
+ expect TrueAssay do
43
+ TrueAssay.refute!(true)
44
+ end
45
+ end
46
+ end
47
+
48
+ end
@@ -0,0 +1,55 @@
1
+ covers 'assay/unequal_assay'
2
+
3
+ testcase UnequalAssay do
4
+
5
+ class_method :pass? do
6
+
7
+ test do
8
+ assert UnequalAssay.pass?(1, 2)
9
+
10
+ refute UnequalAssay.pass?(1, 1)
11
+ refute UnequalAssay.pass?(1, 1.0)
12
+ end
13
+
14
+ end
15
+
16
+ class_method :fail? do
17
+
18
+ test do
19
+ assert UnequalAssay.fail?(1, 1)
20
+ assert UnequalAssay.fail?(1, 1.0)
21
+
22
+ refute UnequalAssay.fail?(1, 2)
23
+ end
24
+
25
+ end
26
+
27
+ class_method :assert! do
28
+
29
+ test do
30
+ UnequalAssay.assert!(1, 2)
31
+ end
32
+
33
+ test do
34
+ expect UnequalAssay do
35
+ UnequalAssay.assert!(1, 1)
36
+ end
37
+ end
38
+
39
+ end
40
+
41
+ class_method :refute! do
42
+
43
+ test do
44
+ UnequalAssay.refute!(1, 1)
45
+ end
46
+
47
+ test do
48
+ expect UnequalAssay do
49
+ UnequalAssay.refute!(1, 2)
50
+ end
51
+ end
52
+
53
+ end
54
+
55
+ end