Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rails_helper'
- RSpec.describe ApplicationController do
- controller do
- def index
- render text: 'nothing'
- end
- end
- let(:user_ip) { '88.198.169.232' }
- let(:country) { 'Germany' }
- let(:locale) { 'de' }
- describe 'set locale by ip' do
- context "when user from Germany" do
- before do
- expect(controller).to receive(:ip).and_return user_ip
- end
- it "should write :de in session locale" do
- expect{
- get :index
- }.to change{ I18n.locale }.to locale.to_sym
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment