diff --git a/app/models/setting.rb b/app/models/setting.rb index 5063aadc..16f59be7 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -141,7 +141,7 @@ class Setting < ActiveRecord::Base end def self.openid? - Object.const_defined?(:OpenID) && self['openid'].to_s == '1' + Object.const_defined?(:OpenID) && self[:openid].to_i > 0 end # Checks if settings have changed since the values were read diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index c5a78dad..83cb4055 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -136,6 +136,11 @@ class AccountControllerTest < Test::Unit::TestCase assert_equal 'http://openid.example.com/good_user', assigns(:user)[:identity_url] end + def test_setting_openid_should_return_true_when_set_to_true + Setting.openid = '1' + assert_equal true, Setting.openid? + end + else puts "Skipping openid tests." end