##// END OF EJS Templates
Replace Date.today with User.current.today (#22320)....
Replace Date.today with User.current.today (#22320). Depending on the offset between a user's configured timezone and the server timezone, Date.today may be more or less often wrong from the user's perspective, leading to things like issues marked as overdue too early or too late, or yesterday / tomorrow being displayed / selected where 'today' is intended. A test case illustrating the problem with Issue#overdue? is included Patch by Jens Kraemer. git-svn-id: http://svn.redmine.org/redmine/trunk@15379 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r9746:76a4b81cf3a9
r14997:ed50d42210ea
Show More
open_id_authentication_mock.rb
46 lines | 1.8 KiB | text/x-ruby | RubyLexer
/ test / mocks / open_id_authentication_mock.rb
Eric Davis
Adding OpenID mock and test. #699...
r2383 # Mocks out OpenID
#
# http://www.northpub.com/articles/2007/04/02/testing-openid-support
Toshi MARUYAMA
remove trailing white-spaces and code clean up test/mocks/open_id_authentication_mock.rb....
r5868 module OpenIdAuthentication
Eric Davis
Adding OpenID mock and test. #699...
r2383
Toshi MARUYAMA
remove trailing white-spaces and code clean up test/mocks/open_id_authentication_mock.rb....
r5868 EXTENSION_FIELDS = {'email' => 'user@somedomain.com',
Eric Davis
Adding OpenID mock and test. #699...
r2383 'nickname' => 'cool_user',
Toshi MARUYAMA
remove trailing white-spaces and code clean up test/mocks/open_id_authentication_mock.rb....
r5868 'country' => 'US',
Eric Davis
Adding OpenID mock and test. #699...
r2383 'postcode' => '12345',
'fullname' => 'Cool User',
Toshi MARUYAMA
remove trailing white-spaces and code clean up test/mocks/open_id_authentication_mock.rb....
r5868 'dob' => '1970-04-01',
Eric Davis
Adding OpenID mock and test. #699...
r2383 'language' => 'en',
Toshi MARUYAMA
remove trailing white-spaces and code clean up test/mocks/open_id_authentication_mock.rb....
r5868 'timezone' => 'America/New_York'}
Eric Davis
Adding OpenID mock and test. #699...
r2383
protected
def authenticate_with_open_id(identity_url = params[:openid_url], options = {}) #:doc:
if User.find_by_identity_url(identity_url) || identity_url.include?('good')
Jean-Philippe Lang
Fixed: Openid registration form should not require user to enter password (#11331)....
r9746 extension_response_fields = {}
Eric Davis
Adding OpenID mock and test. #699...
r2383 # Don't process registration fields unless it is requested.
unless identity_url.include?('blank') || (options[:required].nil? && options[:optional].nil?)
options[:required].each do |field|
extension_response_fields[field.to_s] = EXTENSION_FIELDS[field.to_s]
end unless options[:required].nil?
options[:optional].each do |field|
extension_response_fields[field.to_s] = EXTENSION_FIELDS[field.to_s]
end unless options[:optional].nil?
end
yield Result[:successful], identity_url , extension_response_fields
else
Toshi MARUYAMA
remove trailing white-spaces and code clean up test/mocks/open_id_authentication_mock.rb....
r5868 logger.info "OpenID authentication failed: #{identity_url}"
Eric Davis
Adding OpenID mock and test. #699...
r2383 yield Result[:failed], identity_url, nil
end
end
private
def add_simple_registration_fields(open_id_response, fields)
open_id_response.add_extension_arg('sreg', 'required', [ fields[:required] ].flatten * ',') if fields[:required]
open_id_response.add_extension_arg('sreg', 'optional', [ fields[:optional] ].flatten * ',') if fields[:optional]
end
end