cutest 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/cutest.gemspec +1 -1
- data/lib/cutest.rb +2 -2
- data/test/run.rb +10 -17
- metadata +6 -2
data/cutest.gemspec
CHANGED
data/lib/cutest.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "batch"
|
2
2
|
|
3
3
|
class Cutest < Batch
|
4
|
-
VERSION = "0.1.
|
4
|
+
VERSION = "0.1.4"
|
5
5
|
|
6
6
|
def report_error(_, error)
|
7
7
|
$stderr.puts "#{error}\n"
|
@@ -110,7 +110,7 @@ private
|
|
110
110
|
def test(name = nil, &block)
|
111
111
|
@_test = name
|
112
112
|
|
113
|
-
prepare.each { |
|
113
|
+
prepare.each { |blk| blk.call }
|
114
114
|
block.call(setup && setup.call)
|
115
115
|
end
|
116
116
|
|
data/test/run.rb
CHANGED
@@ -21,40 +21,33 @@ test "output of successful run" do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
test "output of failed run" do
|
24
|
-
alternatives = [
|
25
|
-
[" 0% E\n100% \n", "\nSome errors occured:\n\n>> failed assertion\n=> assert false\n test/fixtures/failure.rb +2\n\n"],
|
26
|
-
[" 0% E\n100% \n", "\nSome errors occured:\n\n>> failed assertion\n=> assert false\n ./test/fixtures/failure.rb +2\n\n"]
|
27
|
-
]
|
28
|
-
|
29
24
|
stdout, stderr = capture do
|
30
25
|
Cutest.run(Dir["test/fixtures/failure.rb"])
|
31
26
|
end
|
32
27
|
|
33
|
-
assert
|
28
|
+
assert stdout == " 0% E\n100% \n"
|
29
|
+
assert stderr["\nSome errors occured:\n\n>> failed assertion\n=> assert false\n"]
|
30
|
+
assert stderr["test/fixtures/failure.rb +2\n\n"]
|
34
31
|
end
|
35
32
|
|
36
33
|
test "output of failed run on a custom assertion" do
|
37
|
-
alternatives = [
|
38
|
-
[" 0% E\n100% \n", "\nSome errors occured:\n\n>> failed custom assertion\n=> assert_empty \"foo\"\n test/fixtures/fail_custom_assertion.rb +6\n\n"],
|
39
|
-
[" 0% E\n100% \n", "\nSome errors occured:\n\n>> failed custom assertion\n=> assert_empty \"foo\"\n ./test/fixtures/fail_custom_assertion.rb +6\n\n"]
|
40
|
-
]
|
41
34
|
|
42
35
|
stdout, stderr = capture do
|
43
36
|
Cutest.run(Dir["test/fixtures/fail_custom_assertion.rb"])
|
44
37
|
end
|
45
38
|
|
46
|
-
assert
|
39
|
+
assert stdout == " 0% E\n100% \n"
|
40
|
+
assert stderr["\nSome errors occured:\n\n>> failed custom assertion\n=> assert_empty \"foo\"\n"]
|
41
|
+
assert stderr["test/fixtures/fail_custom_assertion.rb +6\n\n"]
|
47
42
|
end
|
48
43
|
|
49
44
|
test "output of failed run on an exception" do
|
50
|
-
alternatives = [
|
51
|
-
[" 0% E\n100% \n", "\nSome errors occured:\n\nOops\ntest/fixtures/exception.rb:2:in `foo'\ntest/fixtures/exception.rb:6:in `block in <top (required)>'\n\n"],
|
52
|
-
[" 0% E\n100% \n", "\nSome errors occured:\n\nOops\n./test/fixtures/exception.rb:2:in `foo'\n./test/fixtures/exception.rb:6\n\n"]
|
53
|
-
]
|
54
|
-
|
55
45
|
stdout, stderr = capture do
|
56
46
|
Cutest.run(Dir["test/fixtures/exception.rb"])
|
57
47
|
end
|
58
48
|
|
59
|
-
assert
|
49
|
+
assert stdout == " 0% E\n100% \n"
|
50
|
+
assert stderr["\nSome errors occured:\n\nOops\n"]
|
51
|
+
assert stderr["test/fixtures/exception.rb:2:in `foo'\n"]
|
52
|
+
assert stderr["test/fixtures/exception.rb:6:in `block in <top (required)>'\n\n"]
|
60
53
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cutest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Damian Janowski
|
@@ -26,6 +27,7 @@ dependencies:
|
|
26
27
|
requirements:
|
27
28
|
- - ~>
|
28
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 25
|
29
31
|
segments:
|
30
32
|
- 0
|
31
33
|
- 0
|
@@ -70,6 +72,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
72
|
requirements:
|
71
73
|
- - ">="
|
72
74
|
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
73
76
|
segments:
|
74
77
|
- 0
|
75
78
|
version: "0"
|
@@ -78,6 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
81
|
requirements:
|
79
82
|
- - ">="
|
80
83
|
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
81
85
|
segments:
|
82
86
|
- 0
|
83
87
|
version: "0"
|