1

I'm writing unit tests for a Rails service using minitest. A snippet of my test looks like this:

stub_request(:get, @service_url)
        .with(:headers => @authheader)
        .to_return(:body => "ABC", :status => 200)
get :index

After the get :index, response.code is 200 as expected (and I've changed it to 201 in the .to_return and seen that code be correct after get :index, but every time response.body is "". I'm sure I'm just doing something unimaginably dumb here and welcome being told what a dummy I am. :)

Thanks in advance

minitest 5.8.2 webmock 3.0.1 rails 4

Jason B
  • 11
  • 2
  • 1
    Neeever mind. I figured it out, it wasn't with webmock. It was an issue where my route being tested calls yet another route and the way I was passing back the response needed to render the response.body, not the entire response. It worked functionally but in minitest failed. It was a good catch by minitest. – Jason B Jun 27 '17 at 16:28

0 Answers0