0

I have done the split io with split_client gem for AB test(https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK) set up with Ruby SDK and I am getting the treatment in my application. But when I try to run the tests, I am getting below error

stub_request(:post, "https://events.split.io/api/metrics/time").
  with(
    body: "{\"name\":\"splitChangeFetcher.time\",\"latencies\":[292.122]}",
    headers: {
      'Accept'=>'*/*',
      'Accept-Encoding'=>'gzip,deflate',
      'Authorization'=>'Bearer 4354t',
      'Connection'=>'keep-alive',
      'Content-Type'=>'application/json',
      'Keep-Alive'=>'30',
      'Splitsdkmachineip'=>'0.0.0.1',
      'Splitsdkmachinename'=>'local',
      'Splitsdkversion'=>'ruby-7.0.3',
      'User-Agent'=>'Ruby'
    }).
  to_return(status: 200, body: "", headers: {})

I tried to stub this request in the spec_helper like below

config.before :each do
    stub_request(:any, /events.split.io/)
      .to_return(status: 200, body: "", headers: {})
  end

But still I am getting the errors randomly after running the tests. So what could cause this issue and any alternatives or solutions.

rubyist
  • 3,074
  • 8
  • 37
  • 69

1 Answers1

0

I think you should disable http requests explicitly. In my case I used webmock and i wrote:

setup do
    WebMock.enable!
  end

It is only suggestion for next searching solution.

Alexey
  • 601
  • 7
  • 17