Skip to content

Commit 97d44ad

Browse files
committed
Remove Deprecated Code
When running code in a test suite, it would throw the following warning messages: Deprecation Warnings: `failure_message_for_should_not` is deprecated. Use `failure_message_when_negated` instead. Called from lib/testing/rspec.rb:98:in `block in <top (required)>'. `failure_message_for_should` is deprecated. Use `failure_message` instead. Called from lib/testing/rspec.rb:90:in `block in <top (required)>'. If you need more of the backtrace for any of these deprecations to identify where to make the necessary changes, you can configure `config.raise_errors_for_deprecations!`, and it will turn the deprecation warnings into errors, giving you the full backtrace. 2 deprecation warnings total This change adopts the newer, generic DSL for writing RSpec matchers.
1 parent 47730e8 commit 97d44ad

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/testing/rspec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ def validate_enum(enum_class, item)
8787
end
8888
end
8989

90-
failure_message_for_should do
90+
failure_message do
9191
message = "should act as enumerated"
9292
if @items
9393
message << " and have members #{@items.inspect}"
9494
end
9595
message
9696
end
9797

98-
failure_message_for_should_not do
98+
failure_message_when_negated do
9999
message = "should not act as enumerated"
100100
if @items
101101
message << " with members #{@items.inspect}"
@@ -131,11 +131,11 @@ def validate_enum(enum_class, item)
131131
model_class.has_enumerated?(attribute)
132132
end
133133

134-
failure_message_for_should do
134+
failure_message do
135135
"expected #{attribute} to be an enumerated attribute"
136136
end
137137

138-
failure_message_for_should_not do
138+
failure_message_when_negated do
139139
"expected #{attribute} to not be an enumerated attribute"
140140
end
141141

@@ -166,11 +166,11 @@ def validate_enum(enum_class, item)
166166
end
167167
end
168168

169-
failure_message_for_should do
169+
failure_message do
170170
"expected #{attribute} to match the enum"
171171
end
172172

173-
failure_message_for_should_not do
173+
failure_message_when_negated do
174174
"expected #{attribute} to not match the enum"
175175
end
176176

@@ -179,4 +179,4 @@ def validate_enum(enum_class, item)
179179
end
180180
end
181181

182-
end
182+
end

0 commit comments

Comments
 (0)