rspec-sleeping_king_studios 2.8.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd26d7230b6ba21fe8db04f56e853295255bc89d7262124421f22f3cf66cb061
4
- data.tar.gz: f67b6b6ddd2230663f0b8bcc993418a73d07175916a3fcabe1c152853f0f5a4f
3
+ metadata.gz: 03545cc0d69863c5f6310c8ed1e5a8c9541bf1d1a0a44649935ab4a1ca578e2e
4
+ data.tar.gz: 240b273a4ca9e75bd00ccea3c084c47e5eb03ea6e7f4b20bfeb404d49c0e923c
5
5
  SHA512:
6
- metadata.gz: dc9403a7440e73895753e59ab57b1f595d5ddd5e47c628a61fb56f12980bd0238572449544c82acda3e6260e8a4cf95e20fa472e7a873006c2ab519859faa29a
7
- data.tar.gz: 2a525ea9556c622bdad0631559585c562d83e223a8b987236cb7a0a2a22bc055fd1ef65375e5860425fc2d3b543e31a0ae7eb09c4605e31907974e5a741d568e
6
+ metadata.gz: ac7ba672468c1e1f2a95f0cd3863fdaa5cbf07f1fa86e8e2cf427debf9735fad6899e299a138669e7dd362d017257013feafa654f5fc1a16f65fd7e37b1796a0
7
+ data.tar.gz: 79d398756f2a19af6885906b4ad57fe064a9393fec2b0c6fbd1cdef6827f4c029c2bb71aa688e804c25f663ad9d9816d7d982bfb0b2c3521889d76cbf564a02e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
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
+
3
13
  ## 2.8.1
4
14
 
5
15
  ### Matchers
@@ -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::Consumer
74
+ example_group < RSpec::SleepingKingStudios::Deferred::Examples
75
75
  end
76
76
 
77
77
  def each_ancestor_group_for(example, &) # rubocop:disable Metrics/MethodLength
@@ -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/PredicateName
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?
@@ -32,7 +32,7 @@ module RSpec::SleepingKingStudios::Matchers::Core
32
32
  # expectation, otherwise true.
33
33
  #
34
34
  # @see #matches?
35
- def does_not_match?(actual) # rubocop:disable Metrics/MethodLength, Naming/PredicateName
35
+ def does_not_match?(actual) # rubocop:disable Metrics/MethodLength, Naming/PredicatePrefix
36
36
  super
37
37
 
38
38
  if matcher?(@expected)
@@ -159,7 +159,7 @@ module RSpec::SleepingKingStudios::Matchers::Core
159
159
  "#{format_expected(@actual)}`"
160
160
  end
161
161
 
162
- def equality_matcher
162
+ def equality_matcher # rubocop:disable Naming/PredicateMethod
163
163
  matchers_delegate.be == @expected
164
164
  end
165
165
 
@@ -16,6 +16,8 @@ module RSpec::SleepingKingStudios::Matchers::Core
16
16
  # @param [String, Symbol] original_name The name of the method that is
17
17
  # expected to have an alias.
18
18
  def initialize(original_name)
19
+ super()
20
+
19
21
  @original_name = original_name.intern
20
22
  end
21
23
 
@@ -40,7 +42,7 @@ module RSpec::SleepingKingStudios::Matchers::Core
40
42
  end
41
43
 
42
44
  # (see BaseMatcher#failure_message)
43
- def failure_message
45
+ def failure_message # rubocop:disable Metrics/MethodLength
44
46
  message = "expected #{@actual.inspect} to alias :#{original_name}"
45
47
 
46
48
  message += " as #{aliased_name.inspect}" if aliased_name
@@ -59,8 +61,8 @@ module RSpec::SleepingKingStudios::Matchers::Core
59
61
 
60
62
  if @errors[:does_not_alias_method]
61
63
  message +=
62
- ", but :#{original_name} and :#{aliased_name} are different "\
63
- "methods"
64
+ ", but :#{original_name} and :#{aliased_name} are different " \
65
+ 'methods'
64
66
 
65
67
  return message
66
68
  end
@@ -74,27 +76,30 @@ module RSpec::SleepingKingStudios::Matchers::Core
74
76
 
75
77
  @errors = {}
76
78
 
77
- if aliased_name.nil?
78
- raise ArgumentError.new('must specify a new method name')
79
- end
79
+ raise ArgumentError, 'must specify a new method name' if aliased_name.nil?
80
80
 
81
81
  responds_to_methods? && aliases_method?
82
82
  end
83
83
 
84
84
  private
85
85
 
86
- attr_reader :aliased_name
87
-
88
- attr_reader :original_name
86
+ attr_reader \
87
+ :aliased_name,
88
+ :original_name
89
89
 
90
90
  def aliases_method?
91
- unless @actual.method(original_name) == @actual.method(aliased_name)
92
- @errors[:does_not_alias_method] = true
91
+ original_method = @actual.method(original_name)
92
+ aliased_method = @actual.method(aliased_name)
93
93
 
94
- return false
94
+ return true if original_method == aliased_method
95
+
96
+ if original_method.source_location == aliased_method.source_location
97
+ return true
95
98
  end
96
99
 
97
- true
100
+ @errors[:does_not_alias_method] = true
101
+
102
+ false
98
103
  end
99
104
 
100
105
  def responds_to_methods?
@@ -13,7 +13,7 @@ module RSpec
13
13
  # Minor version.
14
14
  MINOR = 8
15
15
  # Patch version.
16
- PATCH = 1
16
+ PATCH = 2
17
17
  # Prerelease version.
18
18
  PRERELEASE = nil
19
19
  # Build metadata.
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.1
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: 2025-04-27 00:00:00.000000000 Z
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.5
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: []