rspec-sleeping_king_studios 2.7.0 → 2.8.0.rc.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/CHANGELOG.md +25 -0
- data/README.md +228 -9
- data/config/rubocop-rspec.yml +41 -0
- data/lib/rspec/sleeping_king_studios/concerns/example_constants.rb +107 -74
- data/lib/rspec/sleeping_king_studios/concerns/memoized_helpers.rb +19 -0
- data/lib/rspec/sleeping_king_studios/concerns/shared_example_group.rb +5 -2
- data/lib/rspec/sleeping_king_studios/concerns.rb +8 -3
- data/lib/rspec/sleeping_king_studios/configuration.rb +45 -37
- data/lib/rspec/sleeping_king_studios/deferred/call.rb +74 -0
- data/lib/rspec/sleeping_king_studios/deferred/calls/example.rb +42 -0
- data/lib/rspec/sleeping_king_studios/deferred/calls/example_group.rb +42 -0
- data/lib/rspec/sleeping_king_studios/deferred/calls/hook.rb +64 -0
- data/lib/rspec/sleeping_king_studios/deferred/calls/included_examples.rb +34 -0
- data/lib/rspec/sleeping_king_studios/deferred/calls/shared_examples.rb +41 -0
- data/lib/rspec/sleeping_king_studios/deferred/calls.rb +19 -0
- data/lib/rspec/sleeping_king_studios/deferred/consumer.rb +159 -0
- data/lib/rspec/sleeping_king_studios/deferred/definitions.rb +42 -0
- data/lib/rspec/sleeping_king_studios/deferred/dependencies.rb +138 -0
- data/lib/rspec/sleeping_king_studios/deferred/dsl/example_constants.rb +72 -0
- data/lib/rspec/sleeping_king_studios/deferred/dsl/example_groups.rb +69 -0
- data/lib/rspec/sleeping_king_studios/deferred/dsl/examples.rb +84 -0
- data/lib/rspec/sleeping_king_studios/deferred/dsl/hooks.rb +125 -0
- data/lib/rspec/sleeping_king_studios/deferred/dsl/memoized_helpers.rb +123 -0
- data/lib/rspec/sleeping_king_studios/deferred/dsl/shared_examples.rb +128 -0
- data/lib/rspec/sleeping_king_studios/deferred/dsl.rb +26 -0
- data/lib/rspec/sleeping_king_studios/deferred/examples.rb +83 -0
- data/lib/rspec/sleeping_king_studios/deferred/missing.rb +46 -0
- data/lib/rspec/sleeping_king_studios/deferred/provider.rb +164 -0
- data/lib/rspec/sleeping_king_studios/deferred.rb +142 -0
- data/lib/rspec/sleeping_king_studios/matchers/built_in/include_matcher.rb +85 -70
- data/lib/rspec/sleeping_king_studios/matchers/core/deep_matcher.rb +28 -23
- data/lib/rspec/sleeping_king_studios/sandbox.rb +105 -0
- data/lib/rspec/sleeping_king_studios/version.rb +4 -3
- data/lib/rspec/sleeping_king_studios.rb +10 -4
- metadata +36 -141
@@ -1,11 +1,11 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rspec/sleeping_king_studios/matchers/built_in'
|
4
4
|
require 'rspec/sleeping_king_studios/matchers/description'
|
5
5
|
|
6
6
|
module RSpec::SleepingKingStudios::Matchers::BuiltIn
|
7
7
|
# Extensions to the built-in RSpec #include matcher.
|
8
|
-
class IncludeMatcher < RSpec::Matchers::BuiltIn::Include
|
8
|
+
class IncludeMatcher < RSpec::Matchers::BuiltIn::Include # rubocop:disable Metrics/ClassLength
|
9
9
|
include RSpec::SleepingKingStudios::Matchers::Description
|
10
10
|
|
11
11
|
# @param [Array<Hash, Proc, Object>] expected the items expected to be
|
@@ -16,35 +16,30 @@ module RSpec::SleepingKingStudios::Matchers::BuiltIn
|
|
16
16
|
# @yieldparam [Object] item An item from the actual object; yield(item)
|
17
17
|
# should return true if and only if the item matches the desired
|
18
18
|
# predicate.
|
19
|
-
def initialize
|
19
|
+
def initialize(*expected, &block) # rubocop:disable Metrics/MethodLength
|
20
20
|
if block_given?
|
21
21
|
SleepingKingStudios::Tools::CoreTools
|
22
22
|
.deprecate('IncludeMatcher with a block')
|
23
23
|
|
24
|
-
|
24
|
+
expected << block
|
25
25
|
end
|
26
26
|
|
27
27
|
if expected.empty? && !allow_empty_matcher?
|
28
28
|
raise ArgumentError,
|
29
29
|
'must specify an item expectation',
|
30
30
|
caller
|
31
|
-
end
|
31
|
+
end
|
32
32
|
|
33
|
-
super
|
34
|
-
end
|
33
|
+
super(*expected)
|
34
|
+
end
|
35
35
|
|
36
36
|
# (see BaseMatcher#description)
|
37
37
|
def description
|
38
38
|
desc = super
|
39
39
|
|
40
|
-
# Format hash expectations.
|
41
|
-
desc = desc.gsub(/(\S)=>(\S)/, '\1 => \2')
|
42
|
-
|
43
40
|
# Replace processed block expectation stub with proper description.
|
44
|
-
desc
|
45
|
-
|
46
|
-
desc
|
47
|
-
end # method description
|
41
|
+
desc.gsub ':__block_comparison__', 'an item matching the block'
|
42
|
+
end
|
48
43
|
|
49
44
|
# @api private
|
50
45
|
#
|
@@ -53,7 +48,7 @@ module RSpec::SleepingKingStudios::Matchers::BuiltIn
|
|
53
48
|
@actual = actual
|
54
49
|
|
55
50
|
perform_match(actual) { |v| v }
|
56
|
-
end
|
51
|
+
end
|
57
52
|
|
58
53
|
# @api private
|
59
54
|
#
|
@@ -61,93 +56,113 @@ module RSpec::SleepingKingStudios::Matchers::BuiltIn
|
|
61
56
|
def does_not_match?(actual)
|
62
57
|
@actual = actual
|
63
58
|
|
64
|
-
perform_match(actual)
|
65
|
-
end
|
59
|
+
perform_match(actual, &:!)
|
60
|
+
end
|
66
61
|
|
67
62
|
# (see BaseMatcher#failure_message)
|
68
63
|
def failure_message
|
69
64
|
message = super.sub ':__block_comparison__', 'an item matching the block'
|
70
65
|
|
71
|
-
|
66
|
+
unless actual.respond_to?(:include?) || message =~ /does not respond to/
|
67
|
+
message << ', but it does not respond to `include?`'
|
68
|
+
end
|
72
69
|
|
73
70
|
message
|
74
|
-
end
|
71
|
+
end
|
75
72
|
|
76
73
|
# (see BaseMatcher#failure_message_when_negated)
|
77
74
|
def failure_message_when_negated
|
78
75
|
message = super.sub ':__block_comparison__', 'an item matching the block'
|
79
76
|
|
80
|
-
|
77
|
+
unless actual.respond_to?(:include?) || message =~ /does not respond to/
|
78
|
+
message << ', but it does not respond to `include?`'
|
79
|
+
end
|
81
80
|
|
82
81
|
message
|
83
|
-
end
|
82
|
+
end
|
84
83
|
|
85
84
|
private
|
86
85
|
|
87
|
-
def actual_matches_proc?
|
86
|
+
def actual_matches_proc?(expected_item)
|
88
87
|
if actual.respond_to?(:detect)
|
89
88
|
!!actual.detect(&expected_item)
|
90
89
|
else
|
91
90
|
!!expected_item.call(actual)
|
92
|
-
end
|
93
|
-
end
|
91
|
+
end
|
92
|
+
end
|
94
93
|
|
94
|
+
# @deprecated [3.0] Will be removed in version 3.0.
|
95
95
|
def allow_empty_matcher?
|
96
|
-
RSpec
|
97
|
-
end # method strict_matching?
|
96
|
+
return false unless RSpec::Expectations::Version::STRING < '3.12.2'
|
98
97
|
|
99
|
-
|
98
|
+
RSpec
|
99
|
+
.configure { |config| config.sleeping_king_studios.matchers }
|
100
|
+
.allow_empty_include_matchers?
|
101
|
+
end
|
102
|
+
|
103
|
+
def comparing_proc?(expected_item)
|
100
104
|
expected_item.is_a?(Proc)
|
101
|
-
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def expected_items_for_description
|
108
|
+
items = defined?(expecteds) ? expecteds : @expected
|
109
|
+
|
110
|
+
# Preprocess items to stub out block expectations.
|
111
|
+
items.map { |item| item.is_a?(Proc) ? :__block_comparison__ : item }
|
112
|
+
end
|
102
113
|
|
103
|
-
def
|
114
|
+
def find_excluded_items(&)
|
104
115
|
items = defined?(expecteds) ? expecteds : expected
|
105
116
|
|
106
117
|
return [] unless @actual.respond_to?(:include?)
|
107
118
|
|
108
|
-
items.
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
expected_item.each do |(key, value)|
|
113
|
-
memo << { key => value } unless yield actual_hash_includes?(key, value)
|
114
|
-
end # each
|
115
|
-
elsif comparing_hash_keys?(expected_item)
|
116
|
-
memo << expected_item unless yield actual_hash_has_key?(expected_item)
|
117
|
-
else
|
118
|
-
memo << expected_item unless yield actual_collection_includes?(expected_item)
|
119
|
-
end # if-elsif-else
|
120
|
-
|
121
|
-
memo
|
122
|
-
end # inject
|
123
|
-
end # method excluded_from_actual
|
119
|
+
items.each.with_object([]) do |expected_item, excluded_items|
|
120
|
+
match_excluded_item(expected_item, excluded_items, &)
|
121
|
+
end
|
122
|
+
end
|
124
123
|
|
125
|
-
def
|
126
|
-
|
124
|
+
def match_excluded_hash_keys(expected_item, excluded_items)
|
125
|
+
return if yield actual_hash_has_key?(expected_item)
|
127
126
|
|
128
|
-
|
129
|
-
|
130
|
-
end # method expected_items_for_description
|
127
|
+
excluded_items << expected_item
|
128
|
+
end
|
131
129
|
|
132
|
-
def
|
133
|
-
|
134
|
-
|
135
|
-
actual.respond_to?(:include?) && @divergent_items.empty?
|
136
|
-
end # method perform_match
|
130
|
+
def match_excluded_hash_subset(expected_item, excluded_items)
|
131
|
+
expected_item.each do |(key, value)|
|
132
|
+
next if yield actual_hash_includes?(key, value)
|
137
133
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
def
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
134
|
+
excluded_items << { key => value }
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def match_excluded_item(expected_item, excluded_items, &)
|
139
|
+
if comparing_proc?(expected_item)
|
140
|
+
match_excluded_proc(expected_item, excluded_items, &)
|
141
|
+
elsif comparing_hash_to_a_subset?(expected_item)
|
142
|
+
match_excluded_hash_subset(expected_item, excluded_items, &)
|
143
|
+
elsif comparing_hash_keys?(expected_item)
|
144
|
+
match_excluded_hash_keys(expected_item, excluded_items, &)
|
148
145
|
else
|
149
|
-
expected_item
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
|
146
|
+
match_excluded_value(expected_item, excluded_items, &)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def match_excluded_proc(expected_item, excluded_items)
|
151
|
+
return if yield actual_matches_proc?(expected_item)
|
152
|
+
|
153
|
+
excluded_items << :__block_comparison__
|
154
|
+
end
|
155
|
+
|
156
|
+
def match_excluded_value(expected_item, excluded_items)
|
157
|
+
return if yield actual_collection_includes?(expected_item)
|
158
|
+
|
159
|
+
excluded_items << expected_item
|
160
|
+
end
|
161
|
+
|
162
|
+
def perform_match(actual, &)
|
163
|
+
@actual = actual
|
164
|
+
@divergent_items = find_excluded_items(&)
|
165
|
+
actual.respond_to?(:include?) && @divergent_items.empty?
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'hashdiff'
|
4
4
|
|
@@ -9,26 +9,28 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
9
9
|
# Matcher for performing a deep comparison between two objects.
|
10
10
|
#
|
11
11
|
# @since 2.5.0
|
12
|
-
class DeepMatcher < RSpec::SleepingKingStudios::Matchers::BaseMatcher
|
13
|
-
# @param [Object] expected
|
12
|
+
class DeepMatcher < RSpec::SleepingKingStudios::Matchers::BaseMatcher # rubocop:disable Metrics/ClassLength
|
13
|
+
# @param [Object] expected the expected object.
|
14
14
|
def initialize(expected)
|
15
|
+
super()
|
16
|
+
|
15
17
|
@expected = expected
|
16
18
|
end
|
17
19
|
|
18
20
|
# (see BaseMatcher#description)
|
19
21
|
def description
|
20
22
|
"match #{format_expected(@expected)}"
|
21
|
-
end
|
23
|
+
end
|
22
24
|
|
23
25
|
# Inverse of #matches? method.
|
24
26
|
#
|
25
|
-
# @param [Object] actual
|
27
|
+
# @param [Object] actual the object to check.
|
26
28
|
#
|
27
29
|
# @return [Boolean] true if the actual object does not match the
|
28
30
|
# expectation, otherwise true.
|
29
31
|
#
|
30
32
|
# @see #matches?
|
31
|
-
def does_not_match?
|
33
|
+
def does_not_match?(actual) # rubocop:disable Metrics/MethodLength
|
32
34
|
super
|
33
35
|
|
34
36
|
if matcher?(@expected)
|
@@ -45,12 +47,12 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
45
47
|
end
|
46
48
|
|
47
49
|
# (see BaseMatcher#failure_message)
|
48
|
-
def failure_message
|
50
|
+
def failure_message # rubocop:disable Style/TrivialAccessors
|
49
51
|
@failure_message
|
50
52
|
end
|
51
53
|
|
52
54
|
# (see BaseMatcher#failure_message_when_negated)
|
53
|
-
def failure_message_when_negated
|
55
|
+
def failure_message_when_negated # rubocop:disable Style/TrivialAccessors
|
54
56
|
@failure_message_when_negated
|
55
57
|
end
|
56
58
|
|
@@ -65,11 +67,11 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
65
67
|
# value is compared based on the type of the expected value.
|
66
68
|
# - Otherwise, the two objects are compared using an equality comparison.
|
67
69
|
#
|
68
|
-
# @param [Object] actual
|
70
|
+
# @param [Object] actual the object to check.
|
69
71
|
#
|
70
72
|
# @return [Boolean] true if the actual object matches the expectation,
|
71
73
|
# otherwise false.
|
72
|
-
def matches?(actual)
|
74
|
+
def matches?(actual) # rubocop:disable Metrics/MethodLength
|
73
75
|
super
|
74
76
|
|
75
77
|
if matcher?(@expected)
|
@@ -89,11 +91,11 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
89
91
|
|
90
92
|
def compare_arrays(expected, actual)
|
91
93
|
compare_hashes({ _ary: expected }, { _ary: actual })
|
92
|
-
.map { |(char, path, *values)| [char, path[1
|
94
|
+
.map { |(char, path, *values)| [char, path[1..], *values] }
|
93
95
|
end
|
94
96
|
|
95
97
|
def compare_hashes(expected, actual)
|
96
|
-
|
98
|
+
Hashdiff.diff(expected, actual, array_path: true, use_lcs: false) \
|
97
99
|
do |path, exp, act|
|
98
100
|
# Handle missing keys with matcher values.
|
99
101
|
next nil unless nested_key?(actual, path)
|
@@ -135,7 +137,8 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
135
137
|
@matches = diff.empty?
|
136
138
|
|
137
139
|
@failure_message_when_negated =
|
138
|
-
"`expect(#{format_expected(@expected)}).not_to be ==
|
140
|
+
"`expect(#{format_expected(@expected)}).not_to be == " \
|
141
|
+
"#{format_expected(@actual)}`"
|
139
142
|
end
|
140
143
|
|
141
144
|
def diff_hashes
|
@@ -150,7 +153,8 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
150
153
|
@matches = diff.empty?
|
151
154
|
|
152
155
|
@failure_message_when_negated =
|
153
|
-
"`expect(#{format_expected(@expected)}).not_to be ==
|
156
|
+
"`expect(#{format_expected(@expected)}).not_to be == " \
|
157
|
+
"#{format_expected(@actual)}`"
|
154
158
|
end
|
155
159
|
|
156
160
|
def equality_matcher
|
@@ -159,7 +163,7 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
159
163
|
|
160
164
|
def format_diff(diff)
|
161
165
|
diff
|
162
|
-
.sort_by { |(
|
166
|
+
.sort_by { |(_char, path, *_values)| [path.map(&:to_s)] }
|
163
167
|
.map { |item| format_diff_item(*item) }
|
164
168
|
.join "\n"
|
165
169
|
end
|
@@ -177,9 +181,10 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
177
181
|
when '-'
|
178
182
|
"expected #{format_expected(values.first)}"
|
179
183
|
when '~'
|
180
|
-
"expected #{format_expected(values.first)}, got
|
184
|
+
"expected #{format_expected(values.first)}, got " \
|
185
|
+
"#{format_expected(values.last)}"
|
181
186
|
when '+'
|
182
|
-
"got #{values.last
|
187
|
+
"got #{format_expected(values.last)}"
|
183
188
|
end
|
184
189
|
end
|
185
190
|
|
@@ -189,12 +194,12 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
189
194
|
|
190
195
|
def format_message(diff)
|
191
196
|
"expected: == #{format_expected(@expected)}\n" \
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
197
|
+
" got: #{format_expected(@actual)}\n" \
|
198
|
+
"\n" \
|
199
|
+
"(compared using Hashdiff)\n" \
|
200
|
+
"\n" \
|
201
|
+
"Diff:\n" \
|
202
|
+
"#{format_diff(diff)}"
|
198
203
|
end
|
199
204
|
|
200
205
|
def matcher?(object)
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'stringio'
|
4
|
+
|
5
|
+
require 'rspec/core/sandbox'
|
6
|
+
|
7
|
+
require 'rspec/sleeping_king_studios'
|
8
|
+
|
9
|
+
module RSpec::SleepingKingStudios
|
10
|
+
# Helper for running RSpec files in isolation.
|
11
|
+
#
|
12
|
+
# Sandboxed files can be used to test enhancements to RSpec itself, such as
|
13
|
+
# custom matchers or shared or deferred example groups.
|
14
|
+
module Sandbox
|
15
|
+
# Value class for the result of calling a sandboxed spec file.
|
16
|
+
Result = Struct.new(:output, :errors, :json, :status, keyword_init: true) do
|
17
|
+
# @return [Array<String>] the full description for each run example.
|
18
|
+
def example_descriptions
|
19
|
+
json['examples'].map { |hsh| hsh['full_description'] }
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [Array<String>] the full description for each run example with
|
23
|
+
# status "failed".
|
24
|
+
def failing_examples
|
25
|
+
json['examples']
|
26
|
+
.select { |hsh| hsh['status'] == 'failed' }
|
27
|
+
.map { |hsh| hsh['full_description'] }
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [Array<String>] the full description for each run example with
|
31
|
+
# status "passed".
|
32
|
+
def passing_examples
|
33
|
+
json['examples']
|
34
|
+
.select { |hsh| hsh['status'] == 'passed' }
|
35
|
+
.map { |hsh| hsh['full_description'] }
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [Array<String>] the full description for each run example with
|
39
|
+
# status "pending".
|
40
|
+
def pending_examples
|
41
|
+
json['examples']
|
42
|
+
.select { |hsh| hsh['status'] == 'pending' }
|
43
|
+
.map { |hsh| hsh['full_description'] }
|
44
|
+
end
|
45
|
+
|
46
|
+
# @return [String] the summary of the sandboxed spec run.
|
47
|
+
def summary
|
48
|
+
json['summary_line']
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class << self
|
53
|
+
# Runs the specified spec files in a sandbox.
|
54
|
+
#
|
55
|
+
# The examples and other RSpec code in the files will *not* be added to
|
56
|
+
# the current RSpec process.
|
57
|
+
#
|
58
|
+
# @param files [Array<String>] the file names or patterns for the spec
|
59
|
+
# files to run.
|
60
|
+
#
|
61
|
+
# @return [RSpec::SleepingKingStudios::Result] the status and output of
|
62
|
+
# the spec run.
|
63
|
+
def run(*files) # rubocop:disable Metrics/MethodLength
|
64
|
+
if files.empty?
|
65
|
+
raise ArgumentError, 'must specify at least one file or pattern'
|
66
|
+
end
|
67
|
+
|
68
|
+
err = StringIO.new
|
69
|
+
out = StringIO.new
|
70
|
+
status = nil
|
71
|
+
args = format_args(*files)
|
72
|
+
|
73
|
+
RSpec::Core::Sandbox.sandboxed do |config|
|
74
|
+
config.filter_run_when_matching :focus
|
75
|
+
|
76
|
+
status = RSpec::Core::Runner.run(args, err, out)
|
77
|
+
end
|
78
|
+
|
79
|
+
build_result(err:, out:, status:)
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
|
84
|
+
def build_result(err:, out:, status:)
|
85
|
+
*output, raw_json = out.string.lines
|
86
|
+
|
87
|
+
Result.new(
|
88
|
+
output: output.join,
|
89
|
+
errors: err.string,
|
90
|
+
json: JSON.parse(raw_json),
|
91
|
+
status:
|
92
|
+
)
|
93
|
+
end
|
94
|
+
|
95
|
+
def format_args(*files)
|
96
|
+
[
|
97
|
+
'--format=json',
|
98
|
+
'--format=doc',
|
99
|
+
'--order=defined',
|
100
|
+
"--pattern=#{files.join(',')}"
|
101
|
+
]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -11,13 +11,13 @@ module RSpec
|
|
11
11
|
# Major version.
|
12
12
|
MAJOR = 2
|
13
13
|
# Minor version.
|
14
|
-
MINOR =
|
14
|
+
MINOR = 8
|
15
15
|
# Patch version.
|
16
16
|
PATCH = 0
|
17
17
|
# Prerelease version.
|
18
|
-
PRERELEASE =
|
18
|
+
PRERELEASE = :rc
|
19
19
|
# Build metadata.
|
20
|
-
BUILD =
|
20
|
+
BUILD = 0
|
21
21
|
|
22
22
|
class << self
|
23
23
|
# Generates the gem version string from the Version constants.
|
@@ -53,6 +53,7 @@ module RSpec
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
# The current version of the gem.
|
56
57
|
VERSION = Version.to_gem_version
|
57
58
|
end
|
58
59
|
end
|
@@ -1,10 +1,15 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rspec/core'
|
4
4
|
|
5
5
|
module RSpec
|
6
6
|
# Hic Iacet Arthurus, Rex Quondam, Rexque Futurus.
|
7
7
|
module SleepingKingStudios
|
8
|
+
autoload :Concerns, 'rspec/sleeping_king_studios/concerns'
|
9
|
+
autoload :Deferred, 'rspec/sleeping_king_studios/deferred'
|
10
|
+
autoload :Sandbox, 'rspec/sleeping_king_studios/sandbox'
|
11
|
+
|
12
|
+
# @return [String] the path to the installed gem.
|
8
13
|
def self.gem_path
|
9
14
|
pattern =
|
10
15
|
/#{File::SEPARATOR}lib#{File::SEPARATOR}rspec#{File::SEPARATOR}?\z/
|
@@ -12,11 +17,12 @@ module RSpec
|
|
12
17
|
__dir__.sub(pattern, '')
|
13
18
|
end
|
14
19
|
|
20
|
+
# @return [String] the gem version.
|
15
21
|
def self.version
|
16
22
|
@version ||= RSpec::SleepingKingStudios::Version.to_gem_version
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
20
26
|
|
21
27
|
require 'rspec/sleeping_king_studios/configuration'
|
22
28
|
require 'rspec/sleeping_king_studios/version'
|