@@ -218,25 +218,43 @@ class SubUser < User {
218218 # spec 1
219219 out = @ap . awesome ( User . methods . grep ( /first/ ) )
220220
221- if ActiveRecord ::VERSION ::STRING >= '3.2'
222- expect ( out ) . to match ( /\s first\( \* arg.*?\) \s +User/ )
221+ if RUBY_VERSION >= '3.0.0'
222+ expect ( out ) . to match ( /\s first\( \* \* ,\s &&\) / )
223+ elsif RUBY_VERSION >= '2.7.0'
224+ if ActiveRecord ::VERSION ::STRING >= '3.2'
225+ expect ( out ) . to match ( /\s first\( \* \* ,\s &&\) \s +User/ )
226+ else
227+ expect ( out ) . to match ( /\s first\( \* \* ,\s &&\) \s +User \( ActiveRecord::Base\) / )
228+ end
223229 else
224- expect ( out ) . to match ( /\s first\( \* arg.*?\) \s +User \( ActiveRecord::Base\) / )
230+ if ActiveRecord ::VERSION ::STRING >= '3.2'
231+ expect ( out ) . to match ( /\s first\( \* arg.*?\) \s +User/ )
232+ else
233+ expect ( out ) . to match ( /\s first\( \* arg.*?\) \s +User \( ActiveRecord::Base\) / )
234+ end
225235 end
226236
227237 # spec 2
228238 out = @ap . awesome ( User . methods . grep ( /primary_key/ ) )
229- expect ( out ) . to match ( /\s primary_key\( .*?\) \s +User/ )
239+ if RUBY_VERSION >= '3.0.0'
240+ expect ( out ) . to match ( /\s primary_key\( .*?\) / )
241+ else
242+ expect ( out ) . to match ( /\s primary_key\( .*?\) \s +User/ )
243+ end
230244
231245 # spec 3
232246 out = @ap . awesome ( User . methods . grep ( /validate/ ) )
233-
234247 if ActiveRecord ::VERSION ::MAJOR < 3
235248 expect ( out ) . to match ( /\s validate\( \* arg.*?\) \s +User \( ActiveRecord::Base\) / )
236249 else
237- expect ( out ) . to match ( /\s validate\( \* arg.*?\) \s +User/ )
250+ if RUBY_VERSION >= '3.0.0'
251+ expect ( out ) . to match ( /\s validate\( \* arg.*?\) / )
252+ else
253+ expect ( out ) . to match ( /\s validate\( \* arg.*?\) \s +User/ )
254+ end
238255 end
239256
240257 end
241258 end
242259end
260+
0 commit comments