ex_aequo_rspex 0.2.2 → 0.2.3
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5cf5dd95612e3e30cd5dd885c7b616aef9c80e9c7b71915c46233755667b510d
|
|
4
|
+
data.tar.gz: 850d49f4effefa6b108a1a87ed6516f2c221b022a1c9c0e0d19817ae2acc0757
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 49f0152eccf21ba5c68f66bd655355d03a6c463fd6fdcdd8f8949fca17cd9630a343fd443fb5263b29bc5b83c55c44964857c7547f41cda374f4f2a087c37507
|
|
7
|
+
data.tar.gz: 25e88bb11d4643d72a8151da999a85282602f40d3594191c61371eab1001b1c7efc79cf26d9bce8a5bb60f8e1f678635ce7c3eb92f4848e4b34a8cbb38d89848
|
data/README.md
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ExAequo
|
|
4
|
+
module RSpex
|
|
5
|
+
module Helpers
|
|
6
|
+
module SubjectHelpers
|
|
7
|
+
module MatchHelper extend self
|
|
8
|
+
def make_line_matchers(*matchers)
|
|
9
|
+
Regexp.compile(
|
|
10
|
+
matchers
|
|
11
|
+
.map { mk_rgx_part it }
|
|
12
|
+
.join("\n")
|
|
13
|
+
)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
def mk_rgx_part(part)
|
|
18
|
+
case part
|
|
19
|
+
when Regexp
|
|
20
|
+
part.source
|
|
21
|
+
when nil
|
|
22
|
+
".*"
|
|
23
|
+
when String
|
|
24
|
+
Regexp.escape(part)
|
|
25
|
+
else
|
|
26
|
+
raise ArgumentError, "rgx part must be a regex, a string or nil, but was: #{part.inspect}"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative './subject_helpers/match_helper'
|
|
3
4
|
module ExAequo
|
|
4
5
|
module RSpex
|
|
5
6
|
module Helpers
|
|
@@ -72,6 +73,18 @@ module ExAequo
|
|
|
72
73
|
expect(actual).to match(matcher)
|
|
73
74
|
end
|
|
74
75
|
|
|
76
|
+
def it_matches_output(*matches, to: :stdout, &blk)
|
|
77
|
+
match = MatchHelper.make_line_matchers(*matches.flatten)
|
|
78
|
+
case to
|
|
79
|
+
when :stdout
|
|
80
|
+
expect{ instance_eval(&blk) }.to output(match).to_stdout
|
|
81
|
+
when :stderr
|
|
82
|
+
expect{ instance_eval(&blk) }.to output(match).to_stderr
|
|
83
|
+
else
|
|
84
|
+
raise ArgumentError, "to: must be :stdout or :stderr, but was: #{to.inspect}"
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
75
88
|
def it_raises(exception, message=nil, &blk)
|
|
76
89
|
expect { blk ? instance_eval(&blk) : subject }
|
|
77
90
|
.to raise_error(exception, message)
|
|
@@ -69,6 +69,12 @@ module ExAequo
|
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
+
def it_matches_output(*parts, to: :stdout, &blk)
|
|
73
|
+
specify do
|
|
74
|
+
it_matches_output(*parts, to:, &blk)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
72
78
|
def it_raises(exception, message=nil,&blk)
|
|
73
79
|
specify do
|
|
74
80
|
it_raises(exception, message, &blk)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ex_aequo_rspex
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Dober
|
|
@@ -34,6 +34,7 @@ files:
|
|
|
34
34
|
- lib/ex_aequo/rspex.rb
|
|
35
35
|
- lib/ex_aequo/rspex/helpers.rb
|
|
36
36
|
- lib/ex_aequo/rspex/helpers/subject_helpers.rb
|
|
37
|
+
- lib/ex_aequo/rspex/helpers/subject_helpers/match_helper.rb
|
|
37
38
|
- lib/ex_aequo/rspex/macros.rb
|
|
38
39
|
- lib/ex_aequo/rspex/macros/let_macros.rb
|
|
39
40
|
- lib/ex_aequo/rspex/macros/subject_macros.rb
|
|
@@ -49,14 +50,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
49
50
|
requirements:
|
|
50
51
|
- - ">="
|
|
51
52
|
- !ruby/object:Gem::Version
|
|
52
|
-
version:
|
|
53
|
+
version: 4.0.1
|
|
53
54
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
55
|
requirements:
|
|
55
56
|
- - ">="
|
|
56
57
|
- !ruby/object:Gem::Version
|
|
57
58
|
version: '0'
|
|
58
59
|
requirements: []
|
|
59
|
-
rubygems_version: 4.0.
|
|
60
|
+
rubygems_version: 4.0.9
|
|
60
61
|
specification_version: 4
|
|
61
62
|
summary: RSpec macros and helpers
|
|
62
63
|
test_files: []
|