scampi 0.1.2 → 0.1.4
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/exe/scampi +1 -1
- data/lib/scampi/monkey_patches.rb +3 -8
- data/lib/scampi/version.rb +1 -1
- data/lib/scampi.rb +55 -8
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 82b9fac36711a5125614536636294d45b5d94a013894a7de447e131cf46f6cc8
|
|
4
|
+
data.tar.gz: 4ba5a553e3f7d94ce7c53c8f331af6646aaf06f18b5ef88838b4585c33987e40
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 55a95005509df9d72b5cf3ccf1e1dbcae5f71f67cb6cc697a63e874e3e23d175b2fef36c73a726f902da8b83c9676207a261f4c5438e4a65d01c37c736d04691
|
|
7
|
+
data.tar.gz: 252ca9f7c5f9fb2b8837bb1c1201054372455f2c7740500f9ba8e2a8234aad2f48c44e27b46faec49124329729d2adb2ff4b2dc017d4bd9198b9d9000de8de00
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
scampi (0.1.
|
|
4
|
+
scampi (0.1.4)
|
|
5
5
|
colorize-extended
|
|
6
6
|
|
|
7
7
|
GEM
|
|
@@ -22,7 +22,7 @@ DEPENDENCIES
|
|
|
22
22
|
CHECKSUMS
|
|
23
23
|
colorize (1.1.0) sha256=30b5237f0603f6662ab8d1fc2bd4a96142b806c6415d79e45ef5fdc6a0cfc837
|
|
24
24
|
colorize-extended (0.1.0) sha256=e8c39986e41ee2e14623c8fa02cf851ef4b83d2fe1392daa2b4d81f0df7bedc9
|
|
25
|
-
scampi (0.1.
|
|
25
|
+
scampi (0.1.4)
|
|
26
26
|
|
|
27
27
|
BUNDLED WITH
|
|
28
28
|
4.0.7
|
data/exe/scampi
CHANGED
|
@@ -60,14 +60,9 @@ module Kernel
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
# Allow `it` at the top level (outside a describe block).
|
|
63
|
-
#
|
|
63
|
+
# Stored as a raw spec — only `describe` creates subtests.
|
|
64
64
|
def it(description, &block)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
ctx_name = File.basename(file, File.extname(file))
|
|
68
|
-
ctx = Scampi::Context.new(ctx_name) {}
|
|
69
|
-
ctx.it(description, &block)
|
|
70
|
-
ctx.register
|
|
71
|
-
Scampi.queue << ctx
|
|
65
|
+
block ||= proc { should.flunk "not implemented" }
|
|
66
|
+
Scampi.queue << [:spec, description, block]
|
|
72
67
|
end
|
|
73
68
|
end
|
data/lib/scampi/version.rb
CHANGED
data/lib/scampi.rb
CHANGED
|
@@ -35,20 +35,26 @@ module Scampi
|
|
|
35
35
|
@ran = true
|
|
36
36
|
|
|
37
37
|
# Register: evaluate all describe blocks to discover specs
|
|
38
|
-
@queue.each(
|
|
38
|
+
@queue.each { |item| item.register if item.is_a?(Context) }
|
|
39
39
|
|
|
40
|
-
# TAP version + plan
|
|
40
|
+
# TAP version + plan
|
|
41
41
|
puts "TAP version 14"
|
|
42
42
|
puts "1..#{@queue.size}"
|
|
43
43
|
|
|
44
|
-
# Execute
|
|
45
|
-
@queue.each_with_index do |
|
|
46
|
-
passed = context.execute(0)
|
|
44
|
+
# Execute: contexts become subtests, raw specs become flat lines
|
|
45
|
+
@queue.each_with_index do |item, i|
|
|
47
46
|
n = i + 1
|
|
48
|
-
if
|
|
49
|
-
|
|
47
|
+
if item.is_a?(Context)
|
|
48
|
+
passed = item.execute(0)
|
|
49
|
+
if passed
|
|
50
|
+
puts "#{"ok".green} #{n} - #{item.name}"
|
|
51
|
+
else
|
|
52
|
+
puts "#{"not ok".red} #{n} - #{item.name}"
|
|
53
|
+
end
|
|
50
54
|
else
|
|
51
|
-
|
|
55
|
+
_, description, block = item
|
|
56
|
+
Counter[:specifications] += 1
|
|
57
|
+
passed = run_bare_spec(description, block, n)
|
|
52
58
|
end
|
|
53
59
|
end
|
|
54
60
|
|
|
@@ -88,6 +94,47 @@ module Scampi
|
|
|
88
94
|
false
|
|
89
95
|
end
|
|
90
96
|
end
|
|
97
|
+
|
|
98
|
+
def self.run_bare_spec(description, block, n)
|
|
99
|
+
handle_requirement(description, 0, n) do
|
|
100
|
+
begin
|
|
101
|
+
Counter[:depth] += 1
|
|
102
|
+
rescued = false
|
|
103
|
+
begin
|
|
104
|
+
prev_req = Counter[:requirements]
|
|
105
|
+
block.call
|
|
106
|
+
rescue Object => e
|
|
107
|
+
rescued = true
|
|
108
|
+
raise e
|
|
109
|
+
ensure
|
|
110
|
+
if Counter[:requirements] == prev_req and not rescued
|
|
111
|
+
raise Error.new(:missing, "empty specification: #{description}")
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
rescue SystemExit, Interrupt
|
|
115
|
+
raise
|
|
116
|
+
rescue Object => e
|
|
117
|
+
ErrorLog << "#{e.class}: #{e.message}\n"
|
|
118
|
+
e.backtrace.find_all { |line| line !~ /bin\/scampi|\/scampi\.rb:\d+/ }.
|
|
119
|
+
each_with_index { |line, i|
|
|
120
|
+
ErrorLog << "\t#{line}#{i==0 ? ": #{description}" : ""}\n"
|
|
121
|
+
}
|
|
122
|
+
ErrorLog << "\n"
|
|
123
|
+
|
|
124
|
+
if e.kind_of? Error
|
|
125
|
+
Counter[e.count_as] += 1
|
|
126
|
+
e.count_as.to_s.upcase
|
|
127
|
+
else
|
|
128
|
+
Counter[:errors] += 1
|
|
129
|
+
"ERROR: #{e.class}"
|
|
130
|
+
end
|
|
131
|
+
else
|
|
132
|
+
""
|
|
133
|
+
ensure
|
|
134
|
+
Counter[:depth] -= 1
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
91
138
|
end
|
|
92
139
|
|
|
93
140
|
require_relative 'scampi/error'
|