scarpe-components 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +86 -0
- data/lib/scarpe/components/base64.rb +3 -7
- data/lib/scarpe/components/calzini/alert.rb +49 -0
- data/lib/scarpe/components/calzini/art_widgets.rb +203 -0
- data/lib/scarpe/components/calzini/button.rb +39 -0
- data/lib/scarpe/components/calzini/misc.rb +146 -0
- data/lib/scarpe/components/calzini/para.rb +35 -0
- data/lib/scarpe/components/calzini/slots.rb +155 -0
- data/lib/scarpe/components/calzini/text_widgets.rb +65 -0
- data/lib/scarpe/components/calzini.rb +149 -0
- data/lib/scarpe/components/errors.rb +20 -0
- data/lib/scarpe/components/file_helpers.rb +1 -0
- data/lib/scarpe/components/html.rb +131 -0
- data/lib/scarpe/components/minitest_export_reporter.rb +75 -0
- data/lib/scarpe/components/minitest_import_runnable.rb +98 -0
- data/lib/scarpe/components/minitest_result.rb +86 -0
- data/lib/scarpe/components/modular_logger.rb +5 -5
- data/lib/scarpe/components/print_logger.rb +9 -5
- data/lib/scarpe/components/promises.rb +14 -14
- data/lib/scarpe/components/segmented_file_loader.rb +36 -17
- data/lib/scarpe/components/string_helpers.rb +10 -0
- data/lib/scarpe/components/tiranti.rb +225 -0
- data/lib/scarpe/components/unit_test_helpers.rb +45 -5
- data/lib/scarpe/components/version.rb +2 -2
- metadata +18 -2
@@ -125,7 +125,7 @@ module Scarpe::Test::LoggedTest
|
|
125
125
|
def log_config_for_test
|
126
126
|
{
|
127
127
|
"default" => ["debug", "logger/test_failure_#{file_id}.log"],
|
128
|
-
"DisplayService" => ["debug", "logger/
|
128
|
+
"DisplayService" => ["debug", "logger/test_failure_display_service_#{file_id}.log"],
|
129
129
|
}.merge(@additional_log_config || {})
|
130
130
|
end
|
131
131
|
|
@@ -150,8 +150,8 @@ module Scarpe::Test::LoggedTest
|
|
150
150
|
return if ALREADY_SET_UP_LOGGED_TEST_FAILURES[:setup]
|
151
151
|
|
152
152
|
log_dir = self.class.logger_dir
|
153
|
-
raise("Must set logger directory!") unless log_dir
|
154
|
-
raise("Can't find logger directory!") unless File.directory?(log_dir)
|
153
|
+
raise(Scarpe::MustOverrideMethod, "Must set logger directory!") unless log_dir
|
154
|
+
raise(Scarpe::NoSuchFile, "Can't find logger directory!") unless File.directory?(log_dir)
|
155
155
|
|
156
156
|
ALREADY_SET_UP_LOGGED_TEST_FAILURES[:setup] = true
|
157
157
|
# Delete stale test failures, if any, before starting the first failure-logged test
|
@@ -181,11 +181,11 @@ module Scarpe::Test::LoggedTest
|
|
181
181
|
out_loc = filepath.gsub(%r{.log\Z}, ".out.log")
|
182
182
|
|
183
183
|
if out_loc == filepath
|
184
|
-
raise "Something is wrong! Could not figure out failure-log output path for #{filepath.inspect}!"
|
184
|
+
raise Shoes::Errors::InvalidAttributeValueError, "Something is wrong! Could not figure out failure-log output path for #{filepath.inspect}!"
|
185
185
|
end
|
186
186
|
|
187
187
|
if File.exist?(out_loc)
|
188
|
-
raise "Duplicate test file #{out_loc.inspect}? This file should *not* already exist!"
|
188
|
+
raise Scarpe::DuplicateFileError, "Duplicate test file #{out_loc.inspect}? This file should *not* already exist!"
|
189
189
|
end
|
190
190
|
|
191
191
|
out_loc
|
@@ -215,3 +215,43 @@ module Scarpe::Test::LoggedTest
|
|
215
215
|
end
|
216
216
|
end
|
217
217
|
end
|
218
|
+
|
219
|
+
module Scarpe::Test::HTMLAssertions
|
220
|
+
# Assert that `actual_html` is the same as `expected_tag` with `opts`.
|
221
|
+
# This uses Scarpe's HTML tag-based renderer to render the tag and options
|
222
|
+
# into text, and valides that the text is the same.
|
223
|
+
#
|
224
|
+
# @see Scarpe::Components::HTML.render
|
225
|
+
#
|
226
|
+
# @param actual_html [String] the html to compare to
|
227
|
+
# @param expected_tag [String,Symbol] the HTML tag, used to send a method call
|
228
|
+
# @param opts keyword options passed to the tag method call
|
229
|
+
# @yield block passed to the tag method call.
|
230
|
+
# @return [void]
|
231
|
+
def assert_html(actual_html, expected_tag, **opts, &block)
|
232
|
+
expected_html = Scarpe::Components::HTML.render do |h|
|
233
|
+
h.public_send(expected_tag, opts, &block)
|
234
|
+
end
|
235
|
+
|
236
|
+
assert_equal expected_html, actual_html
|
237
|
+
end
|
238
|
+
|
239
|
+
# Assert that `actual_html` includes `expected_tag` with `opts`.
|
240
|
+
# This uses Scarpe's HTML tag-based renderer to render the tag and options
|
241
|
+
# into text, and valides that the full HTML contains that tag.
|
242
|
+
#
|
243
|
+
# @see Scarpe::Components::HTML.render
|
244
|
+
#
|
245
|
+
# @param actual_html [String] the html to compare to
|
246
|
+
# @param expected_tag [String,Symbol] the HTML tag, used to send a method call
|
247
|
+
# @param opts keyword options passed to the tag method call
|
248
|
+
# @yield block passed to the tag method call.
|
249
|
+
# @return [void]
|
250
|
+
def assert_contains_html(actual_html, expected_tag, **opts, &block)
|
251
|
+
expected_html = Scarpe::Components::HTML.render do |h|
|
252
|
+
h.public_send(expected_tag, opts, &block)
|
253
|
+
end
|
254
|
+
|
255
|
+
assert actual_html.include?(expected_html), "Expected #{actual_html.inspect} to include #{expected_html.inspect}!"
|
256
|
+
end
|
257
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scarpe-components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Concetto Rudilosso
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-11-24 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|
@@ -20,14 +20,30 @@ extensions: []
|
|
20
20
|
extra_rdoc_files: []
|
21
21
|
files:
|
22
22
|
- Gemfile
|
23
|
+
- Gemfile.lock
|
23
24
|
- README.md
|
24
25
|
- Rakefile
|
25
26
|
- lib/scarpe/components/base64.rb
|
27
|
+
- lib/scarpe/components/calzini.rb
|
28
|
+
- lib/scarpe/components/calzini/alert.rb
|
29
|
+
- lib/scarpe/components/calzini/art_widgets.rb
|
30
|
+
- lib/scarpe/components/calzini/button.rb
|
31
|
+
- lib/scarpe/components/calzini/misc.rb
|
32
|
+
- lib/scarpe/components/calzini/para.rb
|
33
|
+
- lib/scarpe/components/calzini/slots.rb
|
34
|
+
- lib/scarpe/components/calzini/text_widgets.rb
|
35
|
+
- lib/scarpe/components/errors.rb
|
26
36
|
- lib/scarpe/components/file_helpers.rb
|
37
|
+
- lib/scarpe/components/html.rb
|
38
|
+
- lib/scarpe/components/minitest_export_reporter.rb
|
39
|
+
- lib/scarpe/components/minitest_import_runnable.rb
|
40
|
+
- lib/scarpe/components/minitest_result.rb
|
27
41
|
- lib/scarpe/components/modular_logger.rb
|
28
42
|
- lib/scarpe/components/print_logger.rb
|
29
43
|
- lib/scarpe/components/promises.rb
|
30
44
|
- lib/scarpe/components/segmented_file_loader.rb
|
45
|
+
- lib/scarpe/components/string_helpers.rb
|
46
|
+
- lib/scarpe/components/tiranti.rb
|
31
47
|
- lib/scarpe/components/unit_test_helpers.rb
|
32
48
|
- lib/scarpe/components/version.rb
|
33
49
|
homepage: https://github.com/scarpe-team/scarpe
|