semi working

This commit is contained in:
Enrique García Cota 2012-03-01 17:07:09 +01:00
parent f407bc7a8f
commit b359152757
4 changed files with 8 additions and 4 deletions

2
.rspec
View File

@ -1,2 +0,0 @@
--drb
--colour

View File

@ -3,7 +3,7 @@ module Locomotive
module Drops
class CurrentUser < Base
def logged_in?
false
_source.present?
end
end
end

View File

@ -69,7 +69,7 @@ module Locomotive
'url' => request.url,
'now' => Time.now.utc,
'today' => Date.today,
'current_user' => Locomotive::Liquid::Drops::CurrentUser.new
'current_user' => Locomotive::Liquid::Drops::CurrentUser.new(current_user)
}
assigns.merge!(Locomotive.config.context_assign_extensions)

View File

@ -21,6 +21,12 @@ describe Locomotive::Liquid::Drops::CurrentUser do
@controller.expects(:render).with(:text => "false", :layout => false, :status => :ok).returns(true)
@controller.send(:render_locomotive_page)
end
it 'returns true when there is a user logged in' do
@page.raw_template = '{{ current_user.logged_in? }}'
@page.send(:serialize_template)
@controller.expects(:render).with(:text => "true", :layout => false, :status => :ok).returns(true)
@controller.send(:render_locomotive_page)
end
end