rspec-sleeping_king_studios 2.8.0 → 2.8.2
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 +19 -0
- data/lib/rspec/sleeping_king_studios/deferred/dsl/shared_examples.rb +18 -0
- data/lib/rspec/sleeping_king_studios/deferred/examples.rb +0 -1
- data/lib/rspec/sleeping_king_studios/deferred.rb +1 -1
- data/lib/rspec/sleeping_king_studios/matchers/active_model/have_errors_matcher.rb +1 -0
- data/lib/rspec/sleeping_king_studios/matchers/built_in/include_matcher.rb +2 -2
- data/lib/rspec/sleeping_king_studios/matchers/core/alias_method_matcher.rb +2 -0
- data/lib/rspec/sleeping_king_studios/matchers/core/be_a_uuid_matcher.rb +2 -0
- data/lib/rspec/sleeping_king_studios/matchers/core/be_boolean_matcher.rb +2 -0
- data/lib/rspec/sleeping_king_studios/matchers/core/construct_matcher.rb +1 -0
- data/lib/rspec/sleeping_king_studios/matchers/core/deep_matcher.rb +4 -2
- data/lib/rspec/sleeping_king_studios/matchers/core/delegate_method_matcher.rb +1 -0
- data/lib/rspec/sleeping_king_studios/matchers/core/have_aliased_method_matcher.rb +20 -13
- data/lib/rspec/sleeping_king_studios/matchers/core/have_changed_matcher.rb +2 -0
- data/lib/rspec/sleeping_king_studios/matchers/core/have_constant_matcher.rb +2 -0
- data/lib/rspec/sleeping_king_studios/matchers/core/have_predicate_matcher.rb +1 -0
- data/lib/rspec/sleeping_king_studios/matchers/core/have_property_matcher.rb +1 -0
- data/lib/rspec/sleeping_king_studios/matchers/core/have_reader_matcher.rb +1 -0
- data/lib/rspec/sleeping_king_studios/matchers/core/have_writer_matcher.rb +1 -0
- data/lib/rspec/sleeping_king_studios/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03545cc0d69863c5f6310c8ed1e5a8c9541bf1d1a0a44649935ab4a1ca578e2e
|
4
|
+
data.tar.gz: 240b273a4ca9e75bd00ccea3c084c47e5eb03ea6e7f4b20bfeb404d49c0e923c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac7ba672468c1e1f2a95f0cd3863fdaa5cbf07f1fa86e8e2cf427debf9735fad6899e299a138669e7dd362d017257013feafa654f5fc1a16f65fd7e37b1796a0
|
7
|
+
data.tar.gz: 79d398756f2a19af6885906b4ad57fe064a9393fec2b0c6fbd1cdef6827f4c029c2bb71aa688e804c25f663ad9d9816d7d982bfb0b2c3521889d76cbf564a02e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 2.8.2
|
4
|
+
|
5
|
+
### Deferred Examples
|
6
|
+
|
7
|
+
Fixed behavior of deferred examples when defining and including deferred examples in the same scope.
|
8
|
+
|
9
|
+
### Matchers
|
10
|
+
|
11
|
+
Fixed `HaveAliasedMethod` matching when the original method is from an included module.
|
12
|
+
|
13
|
+
## 2.8.1
|
14
|
+
|
15
|
+
### Matchers
|
16
|
+
|
17
|
+
Added `RSpec::Matchers::Composable` support to all matchers.
|
18
|
+
|
19
|
+
- Adds the `#and`, `#or` methods for chaining matchers.
|
20
|
+
- Adds support for matching using the `#===` method, including in nested data structure comparisons such as the built-in `#match` matcher.
|
21
|
+
|
3
22
|
## 2.8.0
|
4
23
|
|
5
24
|
Updated minimum `Hashdiff` version to `~> 1.1`.
|
@@ -78,18 +78,27 @@ module RSpec::SleepingKingStudios::Deferred::Dsl # rubocop:disable Style/Documen
|
|
78
78
|
#
|
79
79
|
# @return [void]
|
80
80
|
|
81
|
+
# @!macro define_included_examples_method
|
82
|
+
define_included_examples_method :finclude_deferred
|
83
|
+
|
81
84
|
# @!macro define_included_examples_method
|
82
85
|
define_included_examples_method :finclude_examples
|
83
86
|
|
84
87
|
# @!macro define_included_examples_method
|
85
88
|
define_included_examples_method :fwrap_context
|
86
89
|
|
90
|
+
# @!macro define_included_examples_method
|
91
|
+
define_included_examples_method :fwrap_deferred
|
92
|
+
|
87
93
|
# @!macro define_included_examples_method
|
88
94
|
define_included_examples_method :fwrap_examples
|
89
95
|
|
90
96
|
# @!macro define_included_examples_method
|
91
97
|
define_included_examples_method :include_context
|
92
98
|
|
99
|
+
# @!macro define_included_examples_method
|
100
|
+
define_included_examples_method :include_deferred
|
101
|
+
|
93
102
|
# @!macro define_included_examples_method
|
94
103
|
define_included_examples_method :include_examples
|
95
104
|
|
@@ -111,15 +120,24 @@ module RSpec::SleepingKingStudios::Deferred::Dsl # rubocop:disable Style/Documen
|
|
111
120
|
# @!macro define_included_examples_method
|
112
121
|
define_included_examples_method :wrap_context
|
113
122
|
|
123
|
+
# @!macro define_included_examples_method
|
124
|
+
define_included_examples_method :wrap_deferred
|
125
|
+
|
114
126
|
# @!macro define_included_examples_method
|
115
127
|
define_included_examples_method :wrap_examples
|
116
128
|
|
129
|
+
# @!macro define_included_examples_method
|
130
|
+
define_included_examples_method :xinclude_deferred
|
131
|
+
|
117
132
|
# @!macro define_included_examples_method
|
118
133
|
define_included_examples_method :xinclude_examples
|
119
134
|
|
120
135
|
# @!macro define_included_examples_method
|
121
136
|
define_included_examples_method :xwrap_context
|
122
137
|
|
138
|
+
# @!macro define_included_examples_method
|
139
|
+
define_included_examples_method :xwrap_deferred
|
140
|
+
|
123
141
|
# @!macro define_included_examples_method
|
124
142
|
define_included_examples_method :xwrap_examples
|
125
143
|
end
|
@@ -73,7 +73,6 @@ module RSpec::SleepingKingStudios::Deferred
|
|
73
73
|
other.extend RSpec::SleepingKingStudios::Deferred::Definitions
|
74
74
|
other.extend RSpec::SleepingKingStudios::Deferred::Dsl
|
75
75
|
other.include RSpec::SleepingKingStudios::Deferred::Provider
|
76
|
-
other.include RSpec::SleepingKingStudios::Deferred::Consumer
|
77
76
|
|
78
77
|
location = caller_locations(1, 1).first
|
79
78
|
|
@@ -71,7 +71,7 @@ module RSpec::SleepingKingStudios
|
|
71
71
|
return false unless example_group.is_a?(Module)
|
72
72
|
return false if example_group.is_a?(Class)
|
73
73
|
|
74
|
-
example_group < RSpec::SleepingKingStudios::Deferred::
|
74
|
+
example_group < RSpec::SleepingKingStudios::Deferred::Examples
|
75
75
|
end
|
76
76
|
|
77
77
|
def each_ancestor_group_for(example, &) # rubocop:disable Metrics/MethodLength
|
@@ -10,6 +10,7 @@ module RSpec::SleepingKingStudios::Matchers::ActiveModel
|
|
10
10
|
#
|
11
11
|
# @since 1.0.0
|
12
12
|
class HaveErrorsMatcher < RSpec::SleepingKingStudios::Matchers::BaseMatcher
|
13
|
+
include RSpec::Matchers::Composable
|
13
14
|
include RSpec::SleepingKingStudios::Matchers::ActiveModel::HaveErrors
|
14
15
|
|
15
16
|
def initialize
|
@@ -53,7 +53,7 @@ module RSpec::SleepingKingStudios::Matchers::BuiltIn
|
|
53
53
|
# @api private
|
54
54
|
#
|
55
55
|
# @return [Boolean]
|
56
|
-
def does_not_match?(actual) # rubocop:disable Naming/
|
56
|
+
def does_not_match?(actual) # rubocop:disable Naming/PredicatePrefix
|
57
57
|
@actual = actual
|
58
58
|
|
59
59
|
perform_match(actual, &:!)
|
@@ -159,7 +159,7 @@ module RSpec::SleepingKingStudios::Matchers::BuiltIn
|
|
159
159
|
excluded_items << expected_item
|
160
160
|
end
|
161
161
|
|
162
|
-
def perform_match(actual, &)
|
162
|
+
def perform_match(actual, &) # rubocop:disable Naming/PredicateMethod
|
163
163
|
@actual = actual
|
164
164
|
@divergent_items = find_excluded_items(&)
|
165
165
|
actual.respond_to?(:include?) && @divergent_items.empty?
|
@@ -9,6 +9,8 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
9
9
|
#
|
10
10
|
# @since 2.2.0
|
11
11
|
class AliasMethodMatcher < RSpec::SleepingKingStudios::Matchers::Core::HaveAliasedMethodMatcher
|
12
|
+
include RSpec::Matchers::Composable
|
13
|
+
|
12
14
|
# (see BaseMatcher#matches?)
|
13
15
|
def matches?(actual)
|
14
16
|
SleepingKingStudios::Tools::CoreTools.deprecate(
|
@@ -8,6 +8,8 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
8
8
|
#
|
9
9
|
# @since 1.0.0
|
10
10
|
class BeBooleanMatcher < RSpec::SleepingKingStudios::Matchers::BaseMatcher
|
11
|
+
include RSpec::Matchers::Composable
|
12
|
+
|
11
13
|
# (see BaseMatcher#description)
|
12
14
|
def description
|
13
15
|
'be true or false'
|
@@ -10,6 +10,7 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
10
10
|
#
|
11
11
|
# @since 1.0.0
|
12
12
|
class ConstructMatcher < RSpec::SleepingKingStudios::Matchers::BaseMatcher
|
13
|
+
include RSpec::Matchers::Composable
|
13
14
|
include RSpec::SleepingKingStudios::Matchers::Shared::MatchParameters
|
14
15
|
|
15
16
|
# (see BaseMatcher#description)
|
@@ -10,6 +10,8 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
10
10
|
#
|
11
11
|
# @since 2.5.0
|
12
12
|
class DeepMatcher < RSpec::SleepingKingStudios::Matchers::BaseMatcher # rubocop:disable Metrics/ClassLength
|
13
|
+
include RSpec::Matchers::Composable
|
14
|
+
|
13
15
|
# @param [Object] expected the expected object.
|
14
16
|
def initialize(expected)
|
15
17
|
super()
|
@@ -30,7 +32,7 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
30
32
|
# expectation, otherwise true.
|
31
33
|
#
|
32
34
|
# @see #matches?
|
33
|
-
def does_not_match?(actual) # rubocop:disable Metrics/MethodLength, Naming/
|
35
|
+
def does_not_match?(actual) # rubocop:disable Metrics/MethodLength, Naming/PredicatePrefix
|
34
36
|
super
|
35
37
|
|
36
38
|
if matcher?(@expected)
|
@@ -157,7 +159,7 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
157
159
|
"#{format_expected(@actual)}`"
|
158
160
|
end
|
159
161
|
|
160
|
-
def equality_matcher
|
162
|
+
def equality_matcher # rubocop:disable Naming/PredicateMethod
|
161
163
|
matchers_delegate.be == @expected
|
162
164
|
end
|
163
165
|
|
@@ -11,9 +11,13 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
11
11
|
#
|
12
12
|
# @note Prior to 2.7.0, this was named AliasMethodMatcher.
|
13
13
|
class HaveAliasedMethodMatcher < RSpec::SleepingKingStudios::Matchers::BaseMatcher
|
14
|
+
include RSpec::Matchers::Composable
|
15
|
+
|
14
16
|
# @param [String, Symbol] original_name The name of the method that is
|
15
17
|
# expected to have an alias.
|
16
18
|
def initialize(original_name)
|
19
|
+
super()
|
20
|
+
|
17
21
|
@original_name = original_name.intern
|
18
22
|
end
|
19
23
|
|
@@ -38,7 +42,7 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
38
42
|
end
|
39
43
|
|
40
44
|
# (see BaseMatcher#failure_message)
|
41
|
-
def failure_message
|
45
|
+
def failure_message # rubocop:disable Metrics/MethodLength
|
42
46
|
message = "expected #{@actual.inspect} to alias :#{original_name}"
|
43
47
|
|
44
48
|
message += " as #{aliased_name.inspect}" if aliased_name
|
@@ -57,8 +61,8 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
57
61
|
|
58
62
|
if @errors[:does_not_alias_method]
|
59
63
|
message +=
|
60
|
-
", but :#{original_name} and :#{aliased_name} are different "\
|
61
|
-
|
64
|
+
", but :#{original_name} and :#{aliased_name} are different " \
|
65
|
+
'methods'
|
62
66
|
|
63
67
|
return message
|
64
68
|
end
|
@@ -72,27 +76,30 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
72
76
|
|
73
77
|
@errors = {}
|
74
78
|
|
75
|
-
if aliased_name.nil?
|
76
|
-
raise ArgumentError.new('must specify a new method name')
|
77
|
-
end
|
79
|
+
raise ArgumentError, 'must specify a new method name' if aliased_name.nil?
|
78
80
|
|
79
81
|
responds_to_methods? && aliases_method?
|
80
82
|
end
|
81
83
|
|
82
84
|
private
|
83
85
|
|
84
|
-
attr_reader
|
85
|
-
|
86
|
-
|
86
|
+
attr_reader \
|
87
|
+
:aliased_name,
|
88
|
+
:original_name
|
87
89
|
|
88
90
|
def aliases_method?
|
89
|
-
|
90
|
-
|
91
|
+
original_method = @actual.method(original_name)
|
92
|
+
aliased_method = @actual.method(aliased_name)
|
91
93
|
|
92
|
-
|
94
|
+
return true if original_method == aliased_method
|
95
|
+
|
96
|
+
if original_method.source_location == aliased_method.source_location
|
97
|
+
return true
|
93
98
|
end
|
94
99
|
|
95
|
-
true
|
100
|
+
@errors[:does_not_alias_method] = true
|
101
|
+
|
102
|
+
false
|
96
103
|
end
|
97
104
|
|
98
105
|
def responds_to_methods?
|
@@ -11,6 +11,8 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
11
11
|
#
|
12
12
|
# @since 2.2.0
|
13
13
|
class HaveConstantMatcher < RSpec::SleepingKingStudios::Matchers::BaseMatcher
|
14
|
+
include RSpec::Matchers::Composable
|
15
|
+
|
14
16
|
# @param [String, Symbol] expected The name of the constant to check for on
|
15
17
|
# the actual object.
|
16
18
|
def initialize expected
|
@@ -11,6 +11,7 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
11
11
|
#
|
12
12
|
# @since 2.2.0
|
13
13
|
class HavePredicateMatcher < RSpec::SleepingKingStudios::Matchers::BaseMatcher
|
14
|
+
include RSpec::Matchers::Composable
|
14
15
|
include RSpec::SleepingKingStudios::Matchers::Shared::MatchProperty
|
15
16
|
|
16
17
|
# Generates a description of the matcher expectation.
|
@@ -11,6 +11,7 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
11
11
|
#
|
12
12
|
# @since 1.0.0
|
13
13
|
class HavePropertyMatcher < RSpec::SleepingKingStudios::Matchers::BaseMatcher
|
14
|
+
include RSpec::Matchers::Composable
|
14
15
|
include RSpec::SleepingKingStudios::Matchers::Shared::MatchProperty
|
15
16
|
|
16
17
|
# @param [String, Symbol] expected The property to check for on the actual
|
@@ -10,6 +10,7 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
10
10
|
#
|
11
11
|
# @since 1.0.0
|
12
12
|
class HaveReaderMatcher < RSpec::SleepingKingStudios::Matchers::BaseMatcher
|
13
|
+
include RSpec::Matchers::Composable
|
13
14
|
include RSpec::SleepingKingStudios::Matchers::Shared::MatchProperty
|
14
15
|
|
15
16
|
# @param [String, Symbol] expected The property to check for on the actual
|
@@ -10,6 +10,7 @@ module RSpec::SleepingKingStudios::Matchers::Core
|
|
10
10
|
#
|
11
11
|
# @since 1.0.0
|
12
12
|
class HaveWriterMatcher < RSpec::SleepingKingStudios::Matchers::BaseMatcher
|
13
|
+
include RSpec::Matchers::Composable
|
13
14
|
include RSpec::SleepingKingStudios::Matchers::Shared::MatchProperty
|
14
15
|
|
15
16
|
# @param [String, Symbol] expected the property to check for on the actual
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-sleeping_king_studios
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob "Merlin" Smith
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: hashdiff
|
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
- !ruby/object:Gem::Version
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
|
-
rubygems_version: 3.6.
|
193
|
+
rubygems_version: 3.6.9
|
194
194
|
specification_version: 4
|
195
195
|
summary: A collection of RSpec patches and custom matchers.
|
196
196
|
test_files: []
|