Navigation Menu

Skip to content

Commit

Permalink
Drop Result#=== comparison in favor of status accessor.
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Apr 14, 2008
1 parent 0209777 commit c5f60a4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README
Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions lib/open_id_authentication.rb
Expand Up @@ -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 } }
Expand Down
5 changes: 0 additions & 5 deletions test/status_test.rb
Expand Up @@ -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?
Expand Down

0 comments on commit c5f60a4

Please sign in to comment.