From 2acba1c5db1b4bef3ed18d365161ec62a1cfec3a Mon Sep 17 00:00:00 2001 From: voodoorai2000 Date: Sat, 1 Jun 2019 15:32:15 +0200 Subject: [PATCH] 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. --- spec/controllers/remote_translation_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/controllers/remote_translation_controller_spec.rb b/spec/controllers/remote_translation_controller_spec.rb index 47a85a5bf..f38a4aedf 100644 --- a/spec/controllers/remote_translation_controller_spec.rb +++ b/spec/controllers/remote_translation_controller_spec.rb @@ -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