WebMock Stub_request Rspec在Rails中不起作用

时间:2019-05-14 19:54:47

标签: ruby-on-rails rspec webmock

我的RSpec测试失败,因为对GoogleTimeZones进行了API调用。

stub_request(:get, "https://maps.googleapis.com/maps/api/timezone/json?key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&location=7.223929254996364,41.91576628703643&timestamp=1557862636")
  .with(headers: {'Accept'=>'*/*', 
                  'Accept-Encoding'=>'gzip, deflate', 
                  'Host'=>'maps.googleapis.com', 
                  'User-Agent'=>'rest-client/2.0.2 (darwin18.0.0 x86_64) ruby/2.4.1p111'})
  .to_return(status: 200, body: "", headers: {})

然后提出存根请求:

spec_helper.rb

我尝试将其添加到=ARRAYFORMULA(SPLIT(TRANSPOSE(SPLIT(JOIN(",", REPT(SPLIT( INDIRECT("A1:A"&COUNTA(A1:A))&"♦"& INDIRECT("B1:B"&COUNTA(B1:B)), ",")&",", INDIRECT("C1:C"&COUNTA(C1:C)))), ",")), "♦")) 中,实际的API服务类以及失败的RSpec测试文件中。

0 个答案:

没有答案