This commit is contained in:
did 2012-05-30 15:41:11 -07:00
parent 763fe5215f
commit f4ee99b72b
2 changed files with 10 additions and 2 deletions

View File

@ -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)

View File

@ -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