r_spec-clone 1.7.2 → 2.0.0
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/LICENSE.md +1 -1
- data/README.md +138 -237
- data/lib/r_spec/clone/dsl.rb +165 -189
- data/lib/r_spec/clone/error.rb +14 -6
- data/lib/r_spec/clone/expectation_helper/it.rb +19 -21
- data/lib/r_spec/clone/expectation_helper/matcher.rb +115 -0
- data/lib/r_spec/clone/expectation_helper.rb +3 -2
- data/lib/r_spec/clone/expectation_target.rb +50 -18
- data/lib/r_spec/clone/report.rb +65 -0
- data/lib/r_spec/clone.rb +1 -3
- data/lib/r_spec.rb +37 -109
- metadata +20 -29
- data/lib/r_spec/clone/error/pending_expectation.rb +0 -26
- data/lib/r_spec/clone/error/reserved_method.rb +0 -11
- data/lib/r_spec/clone/error/undefined_described_class.rb +0 -11
- data/lib/r_spec/clone/error/undefined_subject.rb +0 -11
- data/lib/r_spec/clone/expectation_helper/its.rb +0 -27
- data/lib/r_spec/clone/expectation_helper/shared.rb +0 -250
- data/lib/r_spec/clone/expectation_target/base.rb +0 -115
- data/lib/r_spec/clone/expectation_target/block.rb +0 -40
- data/lib/r_spec/clone/expectation_target/value.rb +0 -40
- data/lib/r_spec/clone/logger.rb +0 -42
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "matchi"
|
|
4
|
+
|
|
5
|
+
module RSpec
|
|
6
|
+
module Clone
|
|
7
|
+
module ExpectationHelper
|
|
8
|
+
# The matchers of an example, as words: each one builds a matcher of
|
|
9
|
+
# Matchi, which raises `ArgumentError` for an argument it refuses. The
|
|
10
|
+
# expected value is always the one that receives the comparison, so
|
|
11
|
+
# that the actual value cannot vouch for itself.
|
|
12
|
+
#
|
|
13
|
+
# @see https://github.com/fixrb/matchi
|
|
14
|
+
module Matcher
|
|
15
|
+
# @param expected [Object] the expected value
|
|
16
|
+
# @return [Matchi::Eq] `eql?` to the expected value, of its class
|
|
17
|
+
def eq(expected)
|
|
18
|
+
::Matchi::Eq.new(expected)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
alias eql eq
|
|
22
|
+
|
|
23
|
+
# @param expected [Object] the expected object
|
|
24
|
+
# @return [Matchi::Be] the very same object
|
|
25
|
+
def be(expected)
|
|
26
|
+
::Matchi::Be.new(expected)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
alias equal be
|
|
30
|
+
|
|
31
|
+
# @param delta [Numeric] the tolerance
|
|
32
|
+
# @return [Matchi::BeWithin] to complete with `of(expected)`
|
|
33
|
+
def be_within(delta)
|
|
34
|
+
::Matchi::BeWithin.new(delta)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# @param expected [Regexp] the pattern
|
|
38
|
+
# @return [Matchi::Match] a String or a Symbol matching the pattern
|
|
39
|
+
def match(expected)
|
|
40
|
+
::Matchi::Match.new(expected)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# @param expected [Class, String, Symbol] the exception class, or its name
|
|
44
|
+
# @param message [String, Regexp, nil] the expected message
|
|
45
|
+
# @return [Matchi::RaiseException] raising that exception
|
|
46
|
+
def raise_exception(expected, message = nil)
|
|
47
|
+
::Matchi::RaiseException.new(expected, message)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# @return [Matchi::Be] `true` itself
|
|
51
|
+
def be_true
|
|
52
|
+
::Matchi::Be.new(true)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# @return [Matchi::Be] `false` itself
|
|
56
|
+
def be_false
|
|
57
|
+
::Matchi::Be.new(false)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# @return [Matchi::Be] `nil` itself
|
|
61
|
+
def be_nil
|
|
62
|
+
::Matchi::Be.new(nil)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# @param expected [Class, String, Symbol] the class, or its name
|
|
66
|
+
# @return [Matchi::BeAnInstanceOf] an instance of that very class
|
|
67
|
+
def be_an_instance_of(expected)
|
|
68
|
+
::Matchi::BeAnInstanceOf.new(expected)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# @param expected [Module, String, Symbol] the module, or its name
|
|
72
|
+
# @return [Matchi::BeAKindOf] an instance of that module or of a descendant
|
|
73
|
+
def be_a_kind_of(expected)
|
|
74
|
+
::Matchi::BeAKindOf.new(expected)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# @param object [Object] the object to observe
|
|
78
|
+
# @param method [Symbol, String] the method whose value may change,
|
|
79
|
+
# followed by its arguments and its block
|
|
80
|
+
# @return [Matchi::Change] a change, or one to refine with `by`,
|
|
81
|
+
# `by_at_least`, `by_at_most`, `from … to` or `to`
|
|
82
|
+
def change(object, method, ...)
|
|
83
|
+
::Matchi::Change.new(object, method, ...)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# @yieldparam value [Object] the actual value
|
|
87
|
+
# @yieldreturn [Boolean] whether it satisfies the block
|
|
88
|
+
# @return [Matchi::Satisfy]
|
|
89
|
+
def satisfy(&)
|
|
90
|
+
::Matchi::Satisfy.new(&)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
private
|
|
94
|
+
|
|
95
|
+
# A predicate matcher for a name that starts with `be_` or `have_`:
|
|
96
|
+
# `be_empty` asks `empty?`, `have_key(:a)` asks `has_key?(:a)`.
|
|
97
|
+
def method_missing(name, ...)
|
|
98
|
+
return super unless predicate?(name)
|
|
99
|
+
|
|
100
|
+
::Matchi::Predicate.new(name, ...)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def respond_to_missing?(name, include_private = false)
|
|
104
|
+
predicate?(name) || super
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Whether a name is the one of a predicate matcher, as Matchi
|
|
108
|
+
# accepts it.
|
|
109
|
+
def predicate?(name)
|
|
110
|
+
::Matchi::Predicate::NAME.match?(name)
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative File.join("expectation_helper", "it")
|
|
4
|
-
require_relative File.join("expectation_helper", "
|
|
4
|
+
require_relative File.join("expectation_helper", "matcher")
|
|
5
5
|
|
|
6
6
|
module RSpec
|
|
7
7
|
module Clone
|
|
8
|
-
#
|
|
8
|
+
# The words an example can use, prepended to its class: {It} by
|
|
9
|
+
# {Dsl.it}, {Matcher} by {Dsl.its}, which adds `is_expected` itself.
|
|
9
10
|
module ExpectationHelper
|
|
10
11
|
end
|
|
11
12
|
end
|
|
@@ -1,29 +1,61 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
require "spectus"
|
|
4
|
+
|
|
5
|
+
require_relative "report"
|
|
5
6
|
|
|
6
7
|
module RSpec
|
|
7
8
|
module Clone
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# @param
|
|
14
|
-
#
|
|
9
|
+
# The target of an expectation: what `expect` wraps, judged by `to` or
|
|
10
|
+
# `not_to` with a matcher. Every expectation is a MUST of Spectus: the
|
|
11
|
+
# block is called in the requirement, where what it returns or raises
|
|
12
|
+
# is kept for the matcher, and the result is written at once.
|
|
13
|
+
class ExpectationTarget
|
|
14
|
+
# @param callable [#call] gives the actual value: the block of
|
|
15
|
+
# `expect { … }`, or a lambda holding the value of `expect(…)`
|
|
16
|
+
def initialize(callable)
|
|
17
|
+
@callable = callable
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Passes when the matcher matches the actual value.
|
|
21
|
+
#
|
|
22
|
+
# @example
|
|
23
|
+
# expect { "foo".upcase }.to eq("FOO")
|
|
24
|
+
#
|
|
25
|
+
# @param matcher [#match?] the matcher
|
|
26
|
+
# @return [nil]
|
|
27
|
+
# @raise [ArgumentError] when the matcher does not respond to `match?`
|
|
28
|
+
# @raise [TypeError] when the `to_s` of the matcher is not a String
|
|
29
|
+
# @raise [SystemExit] when the expectation is not met
|
|
30
|
+
def to(matcher)
|
|
31
|
+
judge(::Spectus.must(matcher))
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Passes when the matcher does not match the actual value.
|
|
35
|
+
#
|
|
36
|
+
# @example
|
|
37
|
+
# expect { "foo".size }.not_to be(4)
|
|
15
38
|
#
|
|
16
|
-
# @
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
39
|
+
# @param (see #to)
|
|
40
|
+
# @return (see #to)
|
|
41
|
+
# @raise (see #to)
|
|
42
|
+
def not_to(matcher)
|
|
43
|
+
judge(::Spectus.must_not(matcher))
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
20
47
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
48
|
+
# Judges the actual value, and writes the result where the expectation
|
|
49
|
+
# is written: the caller of `to` or `not_to`. A process the block
|
|
50
|
+
# forked and let run on, instead of ending it with exit!, is not the
|
|
51
|
+
# one that writes: it leaves here without a word.
|
|
52
|
+
def judge(requirement)
|
|
53
|
+
location = Report.location
|
|
54
|
+
pid = ::Process.pid
|
|
55
|
+
result = requirement.call(&@callable)
|
|
56
|
+
::Process.exit! unless ::Process.pid == pid
|
|
24
57
|
|
|
25
|
-
|
|
26
|
-
end
|
|
58
|
+
Report.result(location, result)
|
|
27
59
|
end
|
|
28
60
|
end
|
|
29
61
|
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "defi"
|
|
4
|
+
require "matchi"
|
|
5
|
+
require "spectus"
|
|
6
|
+
|
|
7
|
+
module RSpec
|
|
8
|
+
module Clone
|
|
9
|
+
# Writes what happened, one line each: `file:line: Outcome: summary`,
|
|
10
|
+
# as Spectus says it. A met expectation goes to the standard output; one
|
|
11
|
+
# that is not met goes to the standard error and ends the process with
|
|
12
|
+
# the status 1, since the rest of the file would run on a false premise.
|
|
13
|
+
module Report
|
|
14
|
+
# The lib directories of the clone and of the gems it runs, each found
|
|
15
|
+
# by a method of its own, not by the name of a file, which another
|
|
16
|
+
# file could bear, nor by the first file that opened its module, which
|
|
17
|
+
# a spec could be: their frames are left out of the backtrace of an
|
|
18
|
+
# error.
|
|
19
|
+
LIBRARIES = ([
|
|
20
|
+
::Defi::Challenge.instance_method(:to).source_location,
|
|
21
|
+
::Matchi::Be.instance_method(:match?).source_location,
|
|
22
|
+
::Spectus::Requirement.instance_method(:call).source_location
|
|
23
|
+
].map { |location| "#{::File.expand_path("../..", location.fetch(0))}/" } << "#{::File.expand_path("../..", __dir__)}/").freeze
|
|
24
|
+
|
|
25
|
+
private_constant :LIBRARIES
|
|
26
|
+
|
|
27
|
+
# Writes the result of an expectation.
|
|
28
|
+
#
|
|
29
|
+
# @param location [String] `file:line`, where the expectation is written
|
|
30
|
+
# @param result [Spectus::Result] how it went
|
|
31
|
+
# @return [nil]
|
|
32
|
+
# @raise [SystemExit] when the expectation is not met, after writing it
|
|
33
|
+
def self.result(location, result)
|
|
34
|
+
lines = ["#{location}: #{result}".gsub(/\R/) { "\\n" }]
|
|
35
|
+
frames = result.backtrace || []
|
|
36
|
+
frames.each { |frame| lines << " #{frame.gsub(/\R/) { "\\n" }}" unless frame.start_with?(*LIBRARIES) }
|
|
37
|
+
return $stdout.puts(lines) if result.passed?
|
|
38
|
+
|
|
39
|
+
$stdout.flush
|
|
40
|
+
abort(lines.join("\n"))
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Writes a pending example.
|
|
44
|
+
#
|
|
45
|
+
# @param location [String] `file:line`, where the example is written
|
|
46
|
+
# @param message [String] why it is pending, written as valid UTF-8
|
|
47
|
+
# @return [nil]
|
|
48
|
+
def self.pending(location, message)
|
|
49
|
+
message = message.to_s.encode(::Encoding::UTF_8, invalid: :replace, undef: :replace)
|
|
50
|
+
$stdout.puts("#{location}: Pending: #{message}".gsub(/\R/) { "\\n" })
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Where the spec is: the first frame of the caller that is not in the
|
|
54
|
+
# clone's own files, as `file:line`, the file relative to the current
|
|
55
|
+
# directory when it is under it, as valid UTF-8.
|
|
56
|
+
#
|
|
57
|
+
# @return [String]
|
|
58
|
+
def self.location
|
|
59
|
+
frame = caller_locations.find { |location| !location.path.start_with?(LIBRARIES.last) }
|
|
60
|
+
path = ::File.absolute_path(frame.path).delete_prefix(::File.join(::Dir.pwd, ""))
|
|
61
|
+
"#{path}:#{frame.lineno}".encode(::Encoding::UTF_8, invalid: :replace, undef: :replace)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
data/lib/r_spec/clone.rb
CHANGED
data/lib/r_spec.rb
CHANGED
|
@@ -2,71 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative File.join("r_spec", "clone", "dsl")
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# The namespace of RSpec, which the clone takes for its words: `describe`,
|
|
6
|
+
# `context`, `it` and `pending`, at the top level of a spec file.
|
|
6
7
|
#
|
|
7
|
-
# @example
|
|
8
|
-
# require "r_spec"
|
|
9
|
-
#
|
|
10
|
-
# RSpec.describe "The true from the false" do
|
|
11
|
-
# it { expect(false).not_to be true }
|
|
12
|
-
# end
|
|
13
|
-
#
|
|
14
|
-
# # Output to the console
|
|
15
|
-
# # Success: expected false not to be true.
|
|
16
|
-
#
|
|
17
|
-
# @example The basic behavior of arrays
|
|
8
|
+
# @example
|
|
18
9
|
# require "r_spec"
|
|
19
10
|
#
|
|
20
11
|
# RSpec.describe Array do
|
|
21
12
|
# describe "#size" do
|
|
22
|
-
# it "
|
|
13
|
+
# it "reports the number of elements" do
|
|
23
14
|
# expect([1, 2, 3].size).to eq 3
|
|
24
15
|
# end
|
|
25
16
|
# end
|
|
26
17
|
#
|
|
27
18
|
# describe "#empty?" do
|
|
28
|
-
# it "is
|
|
19
|
+
# it "is true when the array holds nothing" do
|
|
29
20
|
# expect([].empty?).to be_true
|
|
30
21
|
# end
|
|
31
|
-
#
|
|
32
|
-
# it "is not empty if there are elements in the array" do
|
|
33
|
-
# expect([1].empty?).to be_false
|
|
34
|
-
# end
|
|
35
22
|
# end
|
|
36
23
|
# end
|
|
37
24
|
#
|
|
38
|
-
# #
|
|
39
|
-
# #
|
|
40
|
-
# # Success: expected to be true.
|
|
41
|
-
# # Success: expected to be false.
|
|
42
|
-
#
|
|
43
|
-
# @example An inherited definition of let
|
|
44
|
-
# require "r_spec"
|
|
45
|
-
#
|
|
46
|
-
# RSpec.describe Integer do
|
|
47
|
-
# let(:answer) { 42 }
|
|
48
|
-
#
|
|
49
|
-
# it "returns the value" do
|
|
50
|
-
# expect(answer).to be(42)
|
|
51
|
-
# end
|
|
52
|
-
#
|
|
53
|
-
# context "when the number is incremented" do
|
|
54
|
-
# let(:answer) { super().next }
|
|
55
|
-
#
|
|
56
|
-
# it "returns the next value" do
|
|
57
|
-
# expect(answer).to be(43)
|
|
58
|
-
# end
|
|
59
|
-
# end
|
|
60
|
-
# end
|
|
61
|
-
#
|
|
62
|
-
# # Output to the console
|
|
63
|
-
# # Success: expected to be 42.
|
|
64
|
-
# # Success: expected to be 43.
|
|
25
|
+
# # spec/array_spec.rb:6: Success: expected 3 to eq 3
|
|
26
|
+
# # spec/array_spec.rb:12: Success: expected true to be true
|
|
65
27
|
#
|
|
66
28
|
# @api public
|
|
67
29
|
module RSpec
|
|
68
|
-
# Defines an example group that establishes a
|
|
69
|
-
#
|
|
30
|
+
# Defines an example group that establishes a context, like _empty array_
|
|
31
|
+
# versus _array with elements_, and runs it in a child process.
|
|
70
32
|
#
|
|
71
33
|
# @example
|
|
72
34
|
# require "r_spec"
|
|
@@ -77,18 +39,19 @@ module RSpec
|
|
|
77
39
|
# it { is_expected.to raise_exception ZeroDivisionError }
|
|
78
40
|
# end
|
|
79
41
|
#
|
|
80
|
-
# #
|
|
81
|
-
# # Success: divided by 0.
|
|
42
|
+
# # spec/zero_spec.rb:6: Success: expected #<ZeroDivisionError: divided by 0> to raise exception ZeroDivisionError
|
|
82
43
|
#
|
|
83
|
-
# @param description [String]
|
|
84
|
-
# "with" or "without"
|
|
85
|
-
# @
|
|
44
|
+
# @param description [String] a description, usually beginning with "when",
|
|
45
|
+
# "with" or "without"
|
|
46
|
+
# @yield the specs of the context
|
|
47
|
+
# @return [nil]
|
|
48
|
+
# @raise [ArgumentError] without a block
|
|
49
|
+
# @raise [NotImplementedError] when this Ruby cannot fork
|
|
50
|
+
# @raise [SystemExit] when a spec of the context did not succeed
|
|
86
51
|
def self.context(description, &)
|
|
87
52
|
Clone::Dsl.context(description, &)
|
|
88
53
|
end
|
|
89
54
|
|
|
90
|
-
# :nocov:
|
|
91
|
-
|
|
92
55
|
# Defines an example group that describes a unit to be tested.
|
|
93
56
|
#
|
|
94
57
|
# @example
|
|
@@ -98,82 +61,47 @@ module RSpec
|
|
|
98
61
|
# it { expect(described_class).to be String }
|
|
99
62
|
# end
|
|
100
63
|
#
|
|
101
|
-
# #
|
|
102
|
-
# # Success: expected to be String.
|
|
64
|
+
# # spec/string_spec.rb:4: Success: expected String to be String
|
|
103
65
|
#
|
|
104
|
-
# @
|
|
105
|
-
#
|
|
106
|
-
#
|
|
107
|
-
#
|
|
108
|
-
# let(:foo) { "foo" }
|
|
109
|
-
#
|
|
110
|
-
# describe "+" do
|
|
111
|
-
# it("concats") { expect(foo + "bar").to eq "foobar" }
|
|
112
|
-
# end
|
|
113
|
-
# end
|
|
114
|
-
#
|
|
115
|
-
# # Output to the console
|
|
116
|
-
# # Success: expected to eq "foobar".
|
|
117
|
-
#
|
|
118
|
-
# @param const [Module, String] A module to include in block context.
|
|
119
|
-
# @param block [Proc] The block to define the specs.
|
|
66
|
+
# @param const [Module, String] the module under test, or a description
|
|
67
|
+
# @yield the specs of the group
|
|
68
|
+
# @return [nil]
|
|
69
|
+
# @raise [ArgumentError] without a block
|
|
120
70
|
def self.describe(const, &)
|
|
121
71
|
Clone::Dsl.describe(const, &)
|
|
122
72
|
end
|
|
123
73
|
|
|
124
|
-
# :nocov:
|
|
125
|
-
|
|
126
74
|
# Defines a concrete test case.
|
|
127
75
|
#
|
|
128
|
-
#
|
|
129
|
-
#
|
|
130
|
-
# @example The integer after 41
|
|
76
|
+
# @example
|
|
131
77
|
# require "r_spec"
|
|
132
78
|
#
|
|
133
79
|
# RSpec.it { expect(41.next).to be 42 }
|
|
134
80
|
#
|
|
135
|
-
# #
|
|
136
|
-
# # Success: expected to be 42.
|
|
137
|
-
#
|
|
138
|
-
# It is usually used inside a {Clone::Dsl.describe} or {Clone::Dsl.context}
|
|
139
|
-
# section.
|
|
140
|
-
#
|
|
141
|
-
# @param name [String, nil] The name of the spec.
|
|
142
|
-
# @param block [Proc] An expectation to evaluate.
|
|
81
|
+
# # spec/next_spec.rb:3: Success: expected 42 to be 42
|
|
143
82
|
#
|
|
144
|
-
# @
|
|
145
|
-
# @
|
|
83
|
+
# @param name [String, nil] the name of the example
|
|
84
|
+
# @yield the example, with its expectations
|
|
85
|
+
# @return [nil]
|
|
86
|
+
# @raise [ArgumentError] without a block
|
|
87
|
+
# @raise [SystemExit] when an expectation is not met
|
|
146
88
|
def self.it(name = nil, &)
|
|
147
89
|
Clone::Dsl.it(name, &)
|
|
148
90
|
end
|
|
149
91
|
|
|
150
|
-
# :
|
|
151
|
-
|
|
152
|
-
# Defines a pending test case.
|
|
153
|
-
#
|
|
154
|
-
# `&block` is never evaluated. It can be used to describe behaviour that is
|
|
155
|
-
# not yet implemented.
|
|
92
|
+
# Defines a pending test case: its block, if any, is never run.
|
|
156
93
|
#
|
|
157
94
|
# @example
|
|
158
95
|
# require "r_spec"
|
|
159
96
|
#
|
|
160
|
-
# RSpec.pending "is
|
|
161
|
-
# expect something to be finished
|
|
162
|
-
# end
|
|
163
|
-
#
|
|
164
|
-
# RSpec.pending "is not yet implemented and waiting"
|
|
165
|
-
#
|
|
166
|
-
# # Output to the console
|
|
167
|
-
# # Warning: is implemented but waiting.
|
|
168
|
-
# # Warning: is not yet implemented and waiting.
|
|
169
|
-
#
|
|
170
|
-
# It is usually used inside a {Clone::Dsl.describe} or {Clone::Dsl.context}
|
|
171
|
-
# section.
|
|
97
|
+
# RSpec.pending "is not yet implemented"
|
|
172
98
|
#
|
|
173
|
-
#
|
|
99
|
+
# # spec/later_spec.rb:3: Pending: is not yet implemented
|
|
174
100
|
#
|
|
175
|
-
# @
|
|
176
|
-
|
|
177
|
-
|
|
101
|
+
# @param message [String] why the example is pending
|
|
102
|
+
# @yield never: the block is not run
|
|
103
|
+
# @return [nil]
|
|
104
|
+
def self.pending(message, &)
|
|
105
|
+
Clone::Dsl.pending(message, &)
|
|
178
106
|
end
|
|
179
107
|
end
|
metadata
CHANGED
|
@@ -1,58 +1,59 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: r_spec-clone
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cyril Kato
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
13
|
+
name: defi
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
16
|
- - "~>"
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
18
|
+
version: '4.0'
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - "~>"
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
25
|
+
version: '4.0'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
27
|
name: matchi
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
30
|
- - "~>"
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
32
|
+
version: '6.0'
|
|
34
33
|
type: :runtime
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
37
|
- - "~>"
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
39
|
+
version: '6.0'
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
41
|
+
name: spectus
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
44
43
|
requirements:
|
|
45
44
|
- - "~>"
|
|
46
45
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
46
|
+
version: '6.0'
|
|
48
47
|
type: :runtime
|
|
49
48
|
prerelease: false
|
|
50
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
50
|
requirements:
|
|
52
51
|
- - "~>"
|
|
53
52
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
55
|
-
description:
|
|
53
|
+
version: '6.0'
|
|
54
|
+
description: 'The essentials of RSpec, with fewer surprises: no monkey patch, no at_exit
|
|
55
|
+
hook, no memoization, a child process per context, and the expected value always
|
|
56
|
+
on the receiving end of a comparison. Built on the testing libraries of Fixrb.'
|
|
56
57
|
email: contact@cyril.email
|
|
57
58
|
executables: []
|
|
58
59
|
extensions: []
|
|
@@ -64,29 +65,20 @@ files:
|
|
|
64
65
|
- lib/r_spec/clone.rb
|
|
65
66
|
- lib/r_spec/clone/dsl.rb
|
|
66
67
|
- lib/r_spec/clone/error.rb
|
|
67
|
-
- lib/r_spec/clone/error/pending_expectation.rb
|
|
68
|
-
- lib/r_spec/clone/error/reserved_method.rb
|
|
69
|
-
- lib/r_spec/clone/error/undefined_described_class.rb
|
|
70
|
-
- lib/r_spec/clone/error/undefined_subject.rb
|
|
71
68
|
- lib/r_spec/clone/expectation_helper.rb
|
|
72
69
|
- lib/r_spec/clone/expectation_helper/it.rb
|
|
73
|
-
- lib/r_spec/clone/expectation_helper/
|
|
74
|
-
- lib/r_spec/clone/expectation_helper/shared.rb
|
|
70
|
+
- lib/r_spec/clone/expectation_helper/matcher.rb
|
|
75
71
|
- lib/r_spec/clone/expectation_target.rb
|
|
76
|
-
- lib/r_spec/clone/
|
|
77
|
-
|
|
78
|
-
- lib/r_spec/clone/expectation_target/value.rb
|
|
79
|
-
- lib/r_spec/clone/logger.rb
|
|
80
|
-
homepage: https://r-spec.dev/
|
|
72
|
+
- lib/r_spec/clone/report.rb
|
|
73
|
+
homepage: https://github.com/cyril/r_spec-clone.rb
|
|
81
74
|
licenses:
|
|
82
75
|
- MIT
|
|
83
76
|
metadata:
|
|
84
77
|
bug_tracker_uri: https://github.com/cyril/r_spec-clone.rb/issues
|
|
78
|
+
changelog_uri: https://github.com/cyril/r_spec-clone.rb#changes-in-20
|
|
85
79
|
documentation_uri: https://rubydoc.info/gems/r_spec-clone
|
|
86
|
-
source_code_uri: https://github.com/cyril/r_spec-clone.rb
|
|
87
|
-
wiki_uri: https://github.com/cyril/r_spec-clone.rb/wiki
|
|
88
80
|
rubygems_mfa_required: 'true'
|
|
89
|
-
|
|
81
|
+
source_code_uri: https://github.com/cyril/r_spec-clone.rb
|
|
90
82
|
rdoc_options: []
|
|
91
83
|
require_paths:
|
|
92
84
|
- lib
|
|
@@ -94,15 +86,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
94
86
|
requirements:
|
|
95
87
|
- - ">="
|
|
96
88
|
- !ruby/object:Gem::Version
|
|
97
|
-
version: 3.
|
|
89
|
+
version: 3.3.0
|
|
98
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
91
|
requirements:
|
|
100
92
|
- - ">="
|
|
101
93
|
- !ruby/object:Gem::Version
|
|
102
94
|
version: '0'
|
|
103
95
|
requirements: []
|
|
104
|
-
rubygems_version:
|
|
105
|
-
signing_key:
|
|
96
|
+
rubygems_version: 4.0.23
|
|
106
97
|
specification_version: 4
|
|
107
98
|
summary: A minimalist RSpec clone
|
|
108
99
|
test_files: []
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "expresenter"
|
|
4
|
-
|
|
5
|
-
module RSpec
|
|
6
|
-
module Clone
|
|
7
|
-
module Error
|
|
8
|
-
# Exception for pending expectations.
|
|
9
|
-
class PendingExpectation < ::RuntimeError
|
|
10
|
-
# @param message [String] The not implemented expectation description.
|
|
11
|
-
#
|
|
12
|
-
# @return [nil] Write a pending expectation to STDOUT.
|
|
13
|
-
def self.result(message)
|
|
14
|
-
::Expresenter.call(true).with(
|
|
15
|
-
actual: new(message),
|
|
16
|
-
definition: "raise exception #{self}",
|
|
17
|
-
error: nil,
|
|
18
|
-
got: false,
|
|
19
|
-
negate: true,
|
|
20
|
-
level: :SHOULD
|
|
21
|
-
)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|