diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4d969f6..05da3b0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -336,7 +336,7 @@ module ApplicationHelper elsif ENV['RAILS_ENV'] == 'development' && params[:theme] params[:theme] else - if profile + if profile && !profile.theme.nil? profile.theme elsif environment environment.theme diff --git a/app/models/profile.rb b/app/models/profile.rb index 217218a..8328d15 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -587,10 +587,6 @@ private :generate_url, :url_options end end - def theme - self[:theme] || environment && environment.theme || 'default' - end - def public? visible && public_profile end diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb index f5e622f..7931437 100644 --- a/test/unit/application_helper_test.rb +++ b/test/unit/application_helper_test.rb @@ -555,6 +555,12 @@ class ApplicationHelperTest < Test::Unit::TestCase assert_equal 'profile-theme', current_theme end + should 'use environment theme if the profile theme is nil' do + stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme')) + stubs(:profile).returns(fast_create(Profile)) + assert_equal environment.theme, current_theme + end + protected def url_for(args = {}) diff --git a/test/unit/profile_test.rb b/test/unit/profile_test.rb index 283a17b..2e2ec83 100644 --- a/test/unit/profile_test.rb +++ b/test/unit/profile_test.rb @@ -909,15 +909,6 @@ class ProfileTest < Test::Unit::TestCase assert_equal 'my-shiny-theme', p.theme end - should 'delegate theme selection to environment by default' do - p = Profile.new - env = mock - p.stubs(:environment).returns(env) - env.expects(:theme).returns('environment-stored-theme') - - assert_equal 'environment-stored-theme', p.theme - end - should 'respond to public? as public_profile' do p1 = fast_create(Profile) p2 = fast_create(Profile, :public_profile => false) -- libgit2 0.21.2