diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 81abb6c..5fc6f04 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -710,7 +710,7 @@ module ApplicationHelper def login_url options = { :controller => 'account', :action => 'login' } - options.merge!(:protocol => 'https://', :host => request.host) unless ENV['RAILS_ENV'] == 'development' + options.merge!(:protocol => 'https://', :host => request.host) unless ENV['RAILS_ENV'] == 'development' || environment.disable_ssl url_for(options) end diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb index d30748c..a8f0132 100644 --- a/test/unit/application_helper_test.rb +++ b/test/unit/application_helper_test.rb @@ -221,6 +221,16 @@ class ApplicationHelperTest < Test::Unit::TestCase assert_same foo, template_stylesheet_tag end + should 'not force ssl when environment has ssl disabled' do + environment = mock + environment.expects(:disable_ssl).returns(true).at_least_once + stubs(:environment).returns(environment) + + expects(:url_for).with(has_entries(:protocol => 'https://')).never + expects(:url_for).with(has_key(:controller)).returns("LALALA") + assert_equal "LALALA", login_url + end + protected def content_tag(tag, content, options = {}) -- libgit2 0.21.2