Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在RSPEC中将Net::HTTP.open模拟为URL_Rspec - Fatal编程技术网

如何在RSPEC中将Net::HTTP.open模拟为URL

如何在RSPEC中将Net::HTTP.open模拟为URL,rspec,Rspec,这是我想在RSPEC中模拟的代码 url = "http://www.somewebsite.com" html = Nokogiri::HTML(open(url).read) html.search('div.yty_bar').remove 我见过其他与我的问题相关的例子,但它们似乎没有帮助 谢谢使用webmock gem-我的问题没有答案吗?

这是我想在RSPEC中模拟的代码

  url = "http://www.somewebsite.com"
  html = Nokogiri::HTML(open(url).read)
  html.search('div.yty_bar').remove
我见过其他与我的问题相关的例子,但它们似乎没有帮助


谢谢

使用webmock gem-

我的问题没有答案吗?