Seems like you are using a rspec integration method.
request_via_redirect
, post_via_redirect
and other methods like that are made to work with testing integration environment. Those functions only work inside a test/spec kind of file.
Try changing your code to the following:
def synchronize
require "uri"
require "net/http"
Net::HTTP.post_form(URI.parse(synchronize_companies_path), params)
end
I am pretty sure that there's a better way of doing what you want to do. Some more information about your intentions should help.