OSDN Git Service

Fixes Setting.openid? (#2764).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 19 Feb 2009 21:03:08 +0000 (21:03 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 19 Feb 2009 21:03:08 +0000 (21:03 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2481 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/setting.rb
test/functional/account_controller_test.rb

index 5063aad..16f59be 100644 (file)
@@ -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
index c5a78da..83cb405 100644 (file)
@@ -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