From 06ff6031fd114d89cd62c0e841591a2381526fb4 Mon Sep 17 00:00:00 2001 From: JoenioCosta Date: Fri, 2 May 2008 15:41:13 +0000 Subject: [PATCH] ActionItem359: ouch! was missing the tests --- app/helpers/application_helper.rb | 6 ++++-- test/unit/application_helper_test.rb | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b33fc85..0c427b3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -493,7 +493,7 @@ module ApplicationHelper content_tag('div', result) end - def theme_option( opt=nil ) + def theme_option(opt = nil) conf = RAILS_ROOT.to_s() + '/public/designs/themes/' + current_theme.to_s() + @@ -528,8 +528,10 @@ module ApplicationHelper end def theme_javascript + option = theme_option(:js) + return if option.nil? html = [] - theme_option(:js).each do |file| + option.each do |file| file = '/designs/themes/'+ current_theme.to_s() + '/javascript/'+ file +'.js' if File.exists? RAILS_ROOT.to_s() +'/public'+ file diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb index 542098f..28e25ab 100644 --- a/test/unit/application_helper_test.rb +++ b/test/unit/application_helper_test.rb @@ -71,6 +71,35 @@ class ApplicationHelperTest < Test::Unit::TestCase assert_same result, link_to_category(cat) end + should 'get current theme' do + assert_equal 'default', current_theme() + end + + should 'nil theme option when no exists theme' do + File.expects(:exists?).returns(false) + assert_nil theme_option() + end + + should 'not nil to ecosol theme option' do + expects(:current_theme).returns('ecosol') + assert_not_nil theme_option() + end + + should 'not nil to zen3 theme option' do + expects(:current_theme).returns('zen3') + assert_not_nil theme_option() + end + + should 'nil javascript theme when no exists theme' do + File.expects(:exists?).returns(false) + assert_nil theme_javascript + end + + should 'not nil javascript theme to ecosol theme' do + expects(:current_theme).returns('ecosol') + assert_not_nil theme_javascript + end + protected def content_tag(tag, content, options) -- libgit2 0.21.2