module GdsApi::TestHelpers::Mapit

def mapit_has_a_postcode(postcode, coords)

def mapit_has_a_postcode(postcode, coords)
  response = {
    "wgs84_lat" => coords.first,
    "wgs84_lon" => coords.last,
    "postcode"  => postcode
  }
  stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/" + postcode.gsub(' ','+') + ".json")
    .to_return(:body => response.to_json, :status => 200)
  stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/partial/" + postcode.split(' ').first + ".json")
    .to_return(:body => response.to_json, :status => 200)
end