I'm writing the following test with Minitest 5.12.0:
require 'minitest/autorun'
require 'nokogiri'
require 'net/http'
class NetClass; end
describe NetClass do
attr_accessor :uri, :net
before do
@uri=URI('http://example.com/index.html')
@net=Net::HTTP.get('example.com', '/index.html')
end
it 'gets uri' do
net.must_match /Example Domain/i
end
end
When running it I get the warning:
DEPRECATED: global use of must_match from net_test.rb:16 Use
_(obj).must_match
instead. This will fail in Minitest 6
To eliminate the warning I change the line:
net.must_match /Example Domain/i
to
_(net).must_match /Example Domain/i
I have not seen the _(obj)
syntax before so my question is what is _()
doing in this case.
Aucun commentaire:
Enregistrer un commentaire