Guest User

Untitled

a guest
Aug 28th, 2014
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.57 KB | None | 0 0
  1. require 'rails_helper'
  2.  
  3. RSpec.describe ApplicationController do
  4.   controller do
  5.     def index
  6.       render text: 'nothing'
  7.     end
  8.   end
  9.  
  10.   let(:user_ip) { '88.198.169.232' }
  11.   let(:country) { 'Germany' }
  12.   let(:locale) { 'de' }
  13.  
  14.   describe 'set locale by ip' do
  15.     context "when user from Germany" do
  16.       before do
  17.         expect(controller).to receive(:ip).and_return user_ip
  18.       end
  19.       it "should write :de in session locale" do
  20.         expect{
  21.           get :index
  22.         }.to change{ I18n.locale }.to locale.to_sym
  23.       end
  24.     end
  25.   end
  26. end
Advertisement
Add Comment
Please, Sign In to add comment