From f4ee99b72b1dbd0b5adac66af68b7786dfa6e0d9 Mon Sep 17 00:00:00 2001 From: did Date: Wed, 30 May 2012 15:41:11 -0700 Subject: [PATCH] fix issue #425 --- lib/locomotive/render.rb | 2 +- spec/lib/locomotive/render_spec.rb | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/locomotive/render.rb b/lib/locomotive/render.rb index 578cb84a..da492af4 100644 --- a/lib/locomotive/render.rb +++ b/lib/locomotive/render.rb @@ -53,7 +53,7 @@ module Locomotive 'url' => request.url, 'now' => Time.now.utc, 'today' => Date.today, - 'locale' => I18n.locale, + 'locale' => I18n.locale.to_s, 'default_locale' => current_site.default_locale.to_s, 'locales' => current_site.locales, 'current_user' => Locomotive::Liquid::Drops::CurrentUser.new(current_locomotive_account) diff --git a/spec/lib/locomotive/render_spec.rb b/spec/lib/locomotive/render_spec.rb index 47665725..3ae0e2f7 100644 --- a/spec/lib/locomotive/render_spec.rb +++ b/spec/lib/locomotive/render_spec.rb @@ -14,16 +14,24 @@ describe 'Locomotive rendering system' do context '#liquid_context' do - it 'includes the current date and time' do + before(:each) do @controller.instance_variable_set(:@page, @page) @controller.stubs(:flash).returns({}) @controller.stubs(:params).returns({}) @controller.stubs(:request).returns(OpenStruct.new(:url => '/')) + end + + it 'includes the current date and time' do context = @controller.send(:locomotive_context) context['now'].should_not be_blank context['today'].should_not be_blank end + it 'includes the locale' do + context = @controller.send(:locomotive_context) + context['locale'].should == 'en' + end + end context 'setting the response' do