diff --git a/README b/README index 7cb0e4c..44b9cfd 100644 --- a/README +++ b/README @@ -144,8 +144,8 @@ You can support it in your app by changing #open_id_authentication # Be sure to yield registration, a third argument in the #authenticate_with_open_id block. authenticate_with_open_id(identity_url, :required => [ :nickname, :email ], - :optional => :fullname) do |status, identity_url, registration| - case status + :optional => :fullname) do |result, identity_url, registration| + case result.status when :missing failed_login "Sorry, the OpenID server couldn't be found" when :canceled diff --git a/lib/open_id_authentication.rb b/lib/open_id_authentication.rb index fa2ff35..bb04d9d 100644 --- a/lib/open_id_authentication.rb +++ b/lib/open_id_authentication.rb @@ -38,12 +38,8 @@ def initialize(code) @code = code end - def ===(code) - if code == :unsuccessful && unsuccessful? - true - else - @code == code - end + def status + @code end ERROR_MESSAGES.keys.each { |state| define_method("#{state}?") { @code == state } } diff --git a/test/status_test.rb b/test/status_test.rb index 15a265c..b1d5e09 100644 --- a/test/status_test.rb +++ b/test/status_test.rb @@ -3,11 +3,6 @@ class StatusTest < Test::Unit::TestCase include OpenIdAuthentication - def test_all_error_codes_should_compare_to_unsuccessful - assert Result[:missing] === :unsuccessful - assert Result[:missing] === :missing - end - def test_state_conditional assert Result[:missing].missing? assert Result[:missing].unsuccessful?