Use Rails 5 syntax to set referer in specs

The previous way was working fine with Rails 4, but now the referer was
returning nil and therefore raising an error in this spec.
This commit is contained in:
voodoorai2000
2019-06-01 15:32:15 +02:00
parent 1e084017d6
commit 2acba1c5db

View File

@@ -9,7 +9,7 @@ describe RemoteTranslationsController do
@remote_translations_params = [{ remote_translatable_id: debate.id.to_s,
remote_translatable_type: debate.class.to_s,
locale: :es }].to_json
allow(controller.request).to receive(:referer).and_return("any_path")
request.env["HTTP_REFERER"] = "any_path"
Delayed::Worker.delay_jobs = true
end