Skip to content

Commit bbe2579

Browse files
committed
specs: add spec for switch_lang action
1 parent 0145656 commit bbe2579

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
require 'spec_helper'
2+
3+
RSpec.describe ApplicationController do
4+
describe '#switch_lang' do
5+
before do
6+
request.env["HTTP_REFERER"] = root_path
7+
end
8+
9+
it 'switches locale to passed language via params' do
10+
original_locale = I18n.locale
11+
new_locale = :ca
12+
13+
expect do
14+
get :switch_lang, locale: new_locale
15+
end.to change(I18n, :locale).from(original_locale).to(new_locale)
16+
end
17+
end
18+
end

0 commit comments

Comments
 (0)