set locale=en to fix locale leakage from other requests

This commit is contained in:
Benjamin Neff 2016-01-23 02:32:41 +01:00
parent cff74982bf
commit c4970332eb
2 changed files with 23 additions and 0 deletions

View file

@ -1,5 +1,12 @@
module DiasporaFederation
# Base-Controller for all DiasporaFederation-Controller
class ApplicationController < ActionController::Base
before_action :set_locale
# Fix locale leakage from other requests.
# Set "en" as locale for every federation request.
def set_locale
I18n.locale = :en
end
end
end

View file

@ -0,0 +1,16 @@
module DiasporaFederation
describe ApplicationController, type: :controller do
controller do
def index
head :ok
end
end
describe "#set_locale" do
it "sets the default locale" do
expect(I18n).to receive(:locale=).with(:en)
get :index
end
end
end
end