nrser 0.1.4 → 0.2.0.pre.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nrser.rb +3 -0
- data/lib/nrser/char.rb +2 -3
- data/lib/nrser/char/alpha_numeric_sub.rb +233 -0
- data/lib/nrser/ext.rb +1 -0
- data/lib/nrser/ext/binding.rb +36 -0
- data/lib/nrser/ext/string.rb +29 -0
- data/lib/nrser/functions/binding.rb +40 -15
- data/lib/nrser/functions/string.rb +17 -1
- data/lib/nrser/functions/string/style.rb +71 -0
- data/lib/nrser/mean_streak.rb +33 -8
- data/lib/nrser/mean_streak/document.rb +221 -36
- data/lib/nrser/refinements/binding.rb +3 -4
- data/lib/nrser/rspex.rb +3 -17
- data/lib/nrser/rspex/example.rb +49 -0
- data/lib/nrser/rspex/example_group.rb +61 -33
- data/lib/nrser/rspex/example_group/describe_called_with.rb +42 -0
- data/lib/nrser/rspex/example_group/describe_spec_file.rb +2 -0
- data/lib/nrser/rspex/format.rb +48 -78
- data/lib/nrser/types.rb +71 -14
- data/lib/nrser/types/attrs.rb +121 -110
- data/lib/nrser/types/bounded.rb +3 -2
- data/lib/nrser/types/combinators.rb +39 -8
- data/lib/nrser/types/hashes.rb +5 -4
- data/lib/nrser/types/is.rb +11 -1
- data/lib/nrser/types/is_a.rb +11 -2
- data/lib/nrser/types/maybe.rb +4 -5
- data/lib/nrser/types/nil.rb +1 -10
- data/lib/nrser/types/not.rb +53 -0
- data/lib/nrser/types/numbers.rb +20 -17
- data/lib/nrser/types/shape.rb +75 -0
- data/lib/nrser/types/strings.rb +49 -59
- data/lib/nrser/types/symbols.rb +13 -18
- data/lib/nrser/types/type.rb +32 -9
- data/lib/nrser/types/when.rb +102 -0
- data/lib/nrser/version.rb +1 -1
- data/spec/{nrser → lib/nrser}/collection/each_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/collection/map_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/env/path/insert_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/env/path_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/errors/abstract_method_error_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/binding/template_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/enumerable/find_all_map_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/enumerable/find_bounded_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/enumerable/find_map_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/enumerable/find_only_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/enumerable/include_slice_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/enumerable/to_h_by_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/exception/format_exception_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/hash/bury_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/hash/guess_label_key_type_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/hash_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/merge_by_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/object/truthy_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/open_struct_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/string/common_prefix_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/string/looks_like_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/string/truncate_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/text/dedent/gotchas_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/text/dedent_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/text/indent_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/text/words_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/tree/each_branch_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/tree/leaves_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/tree/map_branch_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/tree/map_tree_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/tree/transform_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/functions/tree/transformer_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/labs/globlin_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/labs/index_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/logger/dest_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/logger/die_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/logger/install_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/logger/level_int_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/logger/level_name_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/logger/level_sym_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/logger/send_log_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/logger/use_spec.rb +0 -0
- data/spec/lib/nrser/mean_streak/design_spec.rb +68 -0
- data/spec/lib/nrser/mean_streak/identity_instance_spec.rb +21 -0
- data/spec/{nrser → lib/nrser}/meta/class_attrs_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/meta/props/to_and_from_data_spec.rb +17 -11
- data/spec/{nrser → lib/nrser}/meta/props_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/op/message_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/refinements/array_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/refinements/erb_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/refinements/format_exception_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/refinements/hash_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/refinements/indent_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/refinements/object_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/refinements/pathname_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/refinements/set_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/refinements/truncate_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/types/array_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/types/attrs_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/types/combinators_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/types/is_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/types/pairs_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/types/paths_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/types/strings_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/types/symbols_spec.rb +1 -1
- data/spec/{nrser → lib/nrser}/types/tuples_spec.rb +0 -0
- data/spec/{nrser → lib/nrser}/types_spec.rb +0 -0
- data/spec/{nrser_spec.rb → lib/nrser_spec.rb} +0 -0
- metadata +148 -136
data/lib/nrser/rspex.rb
CHANGED
@@ -25,6 +25,8 @@ require 'commonmarker'
|
|
25
25
|
# Project / Package
|
26
26
|
# -----------------------------------------------------------------------
|
27
27
|
require 'nrser'
|
28
|
+
require_relative './rspex/example'
|
29
|
+
require_relative './rspex/example_group'
|
28
30
|
require_relative './rspex/shared_examples'
|
29
31
|
require_relative './rspex/format'
|
30
32
|
|
@@ -122,11 +124,10 @@ def Args *args
|
|
122
124
|
NRSER::RSpex::Args.new args
|
123
125
|
end
|
124
126
|
|
127
|
+
|
125
128
|
# Extensions
|
126
129
|
# =====================================================================
|
127
130
|
|
128
|
-
module NRSER; end
|
129
|
-
|
130
131
|
module NRSER::RSpex
|
131
132
|
|
132
133
|
# Constants
|
@@ -258,23 +259,8 @@ module NRSER::RSpex
|
|
258
259
|
end
|
259
260
|
end
|
260
261
|
|
261
|
-
# Extensions available in examples themselves via RSpec's `config.include`.
|
262
|
-
#
|
263
|
-
module Example
|
264
|
-
def described_class
|
265
|
-
self.class.metadata[:class] || super
|
266
|
-
end
|
267
|
-
|
268
|
-
def described_constructor_args
|
269
|
-
self.class.metadata[:constructor_args]
|
270
|
-
end
|
271
|
-
|
272
|
-
end
|
273
|
-
|
274
262
|
end # module NRSER:RSpex
|
275
263
|
|
276
|
-
require_relative './rspex/example_group'
|
277
|
-
|
278
264
|
|
279
265
|
RSpec.configure do |config|
|
280
266
|
config.extend NRSER::RSpex::ExampleGroup
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
|
5
|
+
# Refinements
|
6
|
+
# =======================================================================
|
7
|
+
|
8
|
+
using NRSER
|
9
|
+
|
10
|
+
|
11
|
+
# Declarations
|
12
|
+
# =======================================================================
|
13
|
+
|
14
|
+
module NRSER::RSpex; end
|
15
|
+
|
16
|
+
|
17
|
+
# Definitions
|
18
|
+
# =======================================================================
|
19
|
+
|
20
|
+
# Extensions available in examples themselves via RSpec's `config.include`.
|
21
|
+
#
|
22
|
+
module NRSER::RSpex::Example
|
23
|
+
|
24
|
+
def described_class
|
25
|
+
self.class.metadata[:class] || super
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
def described_constructor_args
|
30
|
+
self.class.metadata[:constructor_args]
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
# HACK HACK HACK-ITY HACK
|
35
|
+
#
|
36
|
+
# Hook used to `#extend` `base` with
|
37
|
+
# {NRSER::RSpex::ExampleGroup::Overrides}, see discussion/confession
|
38
|
+
# over there.
|
39
|
+
#
|
40
|
+
# @param [Class] base
|
41
|
+
# The class this mixin got included in.
|
42
|
+
#
|
43
|
+
# @return [void]
|
44
|
+
#
|
45
|
+
def self.included base
|
46
|
+
base.extend NRSER::RSpex::ExampleGroup::Overrides
|
47
|
+
end
|
48
|
+
|
49
|
+
end # module NRSER::RSpex::Example
|
@@ -1,44 +1,76 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
# encoding: utf-8
|
3
3
|
|
4
|
+
|
5
|
+
# Declarations
|
6
|
+
# =======================================================================
|
7
|
+
|
8
|
+
module NRSER::RSpex; end
|
9
|
+
|
10
|
+
|
11
|
+
# Definitions
|
12
|
+
# =======================================================================
|
13
|
+
|
4
14
|
# Instance methods to extend examples groups with. Also included globally so
|
5
15
|
# they're available at the top-level in files.
|
6
16
|
#
|
7
17
|
module NRSER::RSpex::ExampleGroup
|
8
18
|
|
9
|
-
#
|
10
|
-
# calling the parent subject with `args` and evaluate `block` in it.
|
19
|
+
# HACK HACK HACK-ITY HACK - Allow for overriding RSpec methods
|
11
20
|
#
|
12
|
-
#
|
13
|
-
# describe "hi sayer" do
|
14
|
-
# subject{ ->( name ) { "Hi #{ name }!" } }
|
15
|
-
#
|
16
|
-
# describe_called_with 'Mom' do
|
17
|
-
# it { is_expected.to eq 'Hi Mom!' }
|
18
|
-
# end
|
19
|
-
# end
|
21
|
+
# Yeah, it has to do with mixin mixing-in ordering - seems to be that when
|
20
22
|
#
|
21
|
-
#
|
22
|
-
# Arguments to call `subject` with to produce the new subject.
|
23
|
+
# config.extend NRSER::RSpex::ExampleGroup
|
23
24
|
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
25
|
+
# {NRSER::RSpex::ExampleGroup} gets mixed in *very early* in the chain,
|
26
|
+
# before {RSpec::Core::ExampleGroup}... why you would provide an explicit
|
27
|
+
# extension mechanism and not give those extensions priority I'm not sure,
|
28
|
+
# but I'm sure I shouldn't be looking into it right now, so here we are:
|
27
29
|
#
|
28
|
-
|
29
|
-
describe_x_type "called with", List(*args),
|
30
|
-
type: :invocation,
|
31
|
-
subject_block: -> { super().call *args },
|
32
|
-
&body
|
33
|
-
end # #describe_called_with
|
34
|
-
|
35
|
-
# Aliases to other names I was using at first... not preferring their use
|
36
|
-
# at the moment.
|
30
|
+
# It turns out that {NRSER::RSpex::Example}, which gets mixed with
|
37
31
|
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
|
41
|
-
|
32
|
+
# config.include NRSER::RSpex::Example
|
33
|
+
#
|
34
|
+
# gets mixed *last*, so by using it's {NRSER::RSpex::Example.included}
|
35
|
+
# hook we can use
|
36
|
+
#
|
37
|
+
# base#extend NRSER::RSpex::ExampleGroup::Overrides
|
38
|
+
#
|
39
|
+
# to mix these guys over the top of RSpec's methods.
|
40
|
+
#
|
41
|
+
# Seems like we could just mix all of {NRSER::RSpex::ExampleGroup} there
|
42
|
+
# to get the behavior I would have expected all along, but maybe it's better
|
43
|
+
# to have these explicit notes for the moment and not change much else until
|
44
|
+
# I get the chance to really check out what's going on.
|
45
|
+
#
|
46
|
+
# And really it's all to override `.described_class` to pick up our
|
47
|
+
# metadata if it's there, but that approach is in quite a bit of use at
|
48
|
+
# this point, and, no, I have no idea how it seemed to work up until this
|
49
|
+
# point :/
|
50
|
+
#
|
51
|
+
module Overrides
|
52
|
+
|
53
|
+
# Override {RSpec::Core::ExampleGroup.described_class} to use RSpex's
|
54
|
+
# `:class` metadata if it's present.
|
55
|
+
#
|
56
|
+
# Because I can't figure out how to feed RSpec the described class
|
57
|
+
# without it being the description, and we want better descriptions.
|
58
|
+
#
|
59
|
+
# Some hackery could def do it, this is RUBY after all, but whatever this
|
60
|
+
# works for now and may even be less fragile.
|
61
|
+
#
|
62
|
+
# @return [Class]
|
63
|
+
# If there's a `:class` in the metadata, or if RSpec has on through the
|
64
|
+
# standard means (`describe MyClass do ...`).
|
65
|
+
#
|
66
|
+
# @return [nil]
|
67
|
+
# If we don't have a class context around.
|
68
|
+
#
|
69
|
+
def described_class
|
70
|
+
metadata[:class] || super()
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
42
74
|
|
43
75
|
|
44
76
|
def describe_message symbol, *args, &body
|
@@ -180,11 +212,6 @@ module NRSER::RSpex::ExampleGroup
|
|
180
212
|
end # #describe_class
|
181
213
|
|
182
214
|
|
183
|
-
def described_class
|
184
|
-
metadata[:class] || super()
|
185
|
-
end
|
186
|
-
|
187
|
-
|
188
215
|
def describe_group title, **metadata, &block
|
189
216
|
describe(
|
190
217
|
"#{ NRSER::RSpex::PREFIXES[:group] } #{ title }",
|
@@ -268,3 +295,4 @@ require_relative './example_group/describe_when'
|
|
268
295
|
require_relative './example_group/describe_setup'
|
269
296
|
require_relative './example_group/describe_use_case'
|
270
297
|
require_relative './example_group/describe_instance'
|
298
|
+
require_relative './example_group/describe_called_with'
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module NRSER::RSpex::ExampleGroup
|
5
|
+
|
6
|
+
# Create a new {RSpec.describe} section where the subject is set by
|
7
|
+
# calling the parent subject with `args` and evaluate `block` in it.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# describe "hi sayer" do
|
11
|
+
# subject{ ->( name ) { "Hi #{ name }!" } }
|
12
|
+
#
|
13
|
+
# describe_called_with 'Mom' do
|
14
|
+
# it { is_expected.to eq 'Hi Mom!' }
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# @param [Array] *args
|
19
|
+
# Arguments to call `subject` with to produce the new subject.
|
20
|
+
#
|
21
|
+
# @param [#call] &block
|
22
|
+
# Block to execute in the context of the example group after refining
|
23
|
+
# the subject.
|
24
|
+
#
|
25
|
+
# @return [void]
|
26
|
+
#
|
27
|
+
def describe_called_with *args, &body
|
28
|
+
describe_x_type "called with", List(*args),
|
29
|
+
type: :invocation,
|
30
|
+
subject_block: -> { super().call *args },
|
31
|
+
&body
|
32
|
+
end # #describe_called_with
|
33
|
+
|
34
|
+
# Aliases to other names I was using at first... not preferring their use
|
35
|
+
# at the moment.
|
36
|
+
#
|
37
|
+
# The `when_` one sucks because Atom de-dents the line, and `describe_`
|
38
|
+
# is just clearer what the block is doing for people reading it.
|
39
|
+
alias_method :called_with, :describe_called_with
|
40
|
+
alias_method :when_called_with, :describe_called_with
|
41
|
+
|
42
|
+
end # module NRSER::RSpex::ExampleGroup
|
@@ -96,6 +96,8 @@ module NRSER::RSpex::ExampleGroup
|
|
96
96
|
compact.
|
97
97
|
# Get the source locations
|
98
98
|
map( &:source_location ).
|
99
|
+
# Get rid of `[nil, nil]` results, which seems to come from C exts
|
100
|
+
reject { |(path, line)| path.nil? || line.nil? }.
|
99
101
|
# Get the first line in the shortest path
|
100
102
|
min_by { |(path, line)| [path.length, line] }
|
101
103
|
|
data/lib/nrser/rspex/format.rb
CHANGED
@@ -10,34 +10,40 @@ using NRSER
|
|
10
10
|
module NRSER::RSpex::Format
|
11
11
|
|
12
12
|
|
13
|
-
|
13
|
+
def self.pastel
|
14
|
+
@pastel ||= Pastel.new
|
15
|
+
end
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
|
18
|
+
def self.mean_streak
|
19
|
+
@mean_streak ||= NRSER::MeanStreak.new do |ms|
|
20
|
+
ms.render_type :emph do |doc, node|
|
21
|
+
italic doc.render_children( node )
|
22
|
+
end
|
23
|
+
|
24
|
+
ms.render_type :strong do |doc, node|
|
25
|
+
bold doc.render_children( node )
|
26
|
+
end
|
27
|
+
|
28
|
+
ms.render_type :code do |doc, node|
|
29
|
+
code node.string_content
|
30
|
+
end
|
31
|
+
end
|
23
32
|
end
|
24
33
|
|
25
34
|
|
26
|
-
# Italicize a string
|
35
|
+
# Italicize a string via "Unicode Math Italic" substitution.
|
27
36
|
#
|
28
|
-
# @param [
|
29
|
-
#
|
30
|
-
#
|
31
|
-
# @return [return_type]
|
32
|
-
# @todo Document return value.
|
37
|
+
# @param [String] string
|
38
|
+
# @return [String]
|
33
39
|
#
|
34
40
|
def self.unicode_italic string
|
35
|
-
|
41
|
+
NRSER.u_italic string
|
36
42
|
end # .italic
|
37
43
|
|
38
44
|
|
39
45
|
def self.esc_seq_italic string
|
40
|
-
|
46
|
+
pastel.italic string
|
41
47
|
end
|
42
48
|
|
43
49
|
|
@@ -48,77 +54,36 @@ module NRSER::RSpex::Format
|
|
48
54
|
singleton_class.send :alias_method, :i, :italic
|
49
55
|
|
50
56
|
|
51
|
-
def self.
|
52
|
-
|
57
|
+
def self.esc_seq_bold string
|
58
|
+
pastel.bold string
|
53
59
|
end
|
54
60
|
|
55
61
|
|
56
|
-
#
|
62
|
+
# Bold a string via "Unicode Math Bold" substitution.
|
57
63
|
#
|
58
|
-
# @param [
|
59
|
-
#
|
60
|
-
#
|
61
|
-
# @return [return_type]
|
62
|
-
# @todo Document return value.
|
64
|
+
# @param [String] string
|
65
|
+
# @return [String]
|
63
66
|
#
|
64
|
-
def self.
|
65
|
-
|
66
|
-
|
67
|
-
transformed = transform_node( doc ).only!
|
68
|
-
commonmark = transformed.to_commonmark
|
69
|
-
ansi = fix_esc_seq commonmark
|
70
|
-
ansi
|
71
|
-
end # .render_commonmark
|
67
|
+
def self.unicode_bold string
|
68
|
+
NRSER.u_bold string
|
69
|
+
end
|
72
70
|
|
73
71
|
|
74
|
-
def self.
|
75
|
-
|
76
|
-
node.string_content = string_content
|
77
|
-
}
|
72
|
+
def self.bold string
|
73
|
+
public_send "#{ RSpec.configuration.x_style }_#{ __method__ }", string
|
78
74
|
end
|
79
75
|
|
76
|
+
singleton_class.send :alias_method, :b, :bold
|
77
|
+
|
80
78
|
|
81
|
-
def self.
|
82
|
-
|
79
|
+
def self.code string
|
80
|
+
pastel.yellow string
|
83
81
|
end
|
84
82
|
|
85
83
|
|
86
|
-
def self.
|
87
|
-
|
88
|
-
|
89
|
-
[
|
90
|
-
pastel_node( :italic ),
|
91
|
-
node.map { |child| transform_node child },
|
92
|
-
pastel_node( :clear ),
|
93
|
-
].flatten
|
94
|
-
when :strong
|
95
|
-
[
|
96
|
-
pastel_node( :bold ),
|
97
|
-
node.map { |child| transform_node child},
|
98
|
-
pastel_node( :clear ),
|
99
|
-
].flatten
|
100
|
-
when :text
|
101
|
-
[node]
|
102
|
-
when :code
|
103
|
-
[
|
104
|
-
pastel_node( :magenta ),
|
105
|
-
text_node( node.string_content ),
|
106
|
-
pastel_node( :clear ),
|
107
|
-
]
|
108
|
-
else
|
109
|
-
new_node = CommonMarker::Node.new node.type
|
110
|
-
|
111
|
-
# new_node.string_content = node.string_content
|
112
|
-
|
113
|
-
node.
|
114
|
-
each { |child|
|
115
|
-
transform_node( child ).each { |new_child|
|
116
|
-
new_node.append_child new_child
|
117
|
-
}
|
118
|
-
}
|
119
|
-
|
120
|
-
[new_node]
|
121
|
-
end
|
84
|
+
def self.md_code_quote string
|
85
|
+
quote = '`' * ((string.scan( /`+/ ).map( &:length ).max || 0) + 1)
|
86
|
+
"#{ quote }#{ string }#{ quote }"
|
122
87
|
end
|
123
88
|
|
124
89
|
|
@@ -136,7 +101,7 @@ module NRSER::RSpex::Format
|
|
136
101
|
prefixes = RSpec.configuration.x_type_prefixes
|
137
102
|
|
138
103
|
prefix = prefixes[type] ||
|
139
|
-
|
104
|
+
pastel.magenta( i( type.to_s.upcase.gsub('_', ' ') ) )
|
140
105
|
|
141
106
|
"#{ prefix } #{ description }"
|
142
107
|
end # .format_type
|
@@ -153,7 +118,12 @@ module NRSER::RSpex::Format
|
|
153
118
|
parts.
|
154
119
|
map { |part|
|
155
120
|
if part.respond_to? :to_desc
|
156
|
-
part.to_desc
|
121
|
+
desc = part.to_desc
|
122
|
+
if desc.empty?
|
123
|
+
''
|
124
|
+
else
|
125
|
+
md_code_quote part.to_desc
|
126
|
+
end
|
157
127
|
elsif part.is_a? String
|
158
128
|
part
|
159
129
|
else
|
@@ -163,7 +133,7 @@ module NRSER::RSpex::Format
|
|
163
133
|
join( ' ' ).
|
164
134
|
squish.
|
165
135
|
thru { |description|
|
166
|
-
|
136
|
+
mean_streak.render prepend_type( type, description )
|
167
137
|
}
|
168
138
|
end # .description
|
169
139
|
|