diff options
author | Go MAEDA <maeda@farend.jp> | 2019-05-04 15:59:50 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2019-05-04 15:59:50 +0000 |
commit | bf0246ce83b3fe1dcc986bc4fc6acbc513330edd (patch) | |
tree | c31ffd9c10b608d8b48c4900bf1afa4c958a3678 /test | |
parent | 400e1ca2ffffa9f2d4383e30c8c2c0e0b02c964b (diff) | |
download | redmine-bf0246ce83b3fe1dcc986bc4fc6acbc513330edd.tar.gz redmine-bf0246ce83b3fe1dcc986bc4fc6acbc513330edd.zip |
Add avatar_server_url configuration option in order to support Libravatar (#9112).
Patch by Go MAEDA.
git-svn-id: http://svn.redmine.org/redmine/trunk@18124 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/my_controller_test.rb | 8 | ||||
-rw-r--r-- | test/helpers/application_helper_test.rb | 15 |
2 files changed, 20 insertions, 3 deletions
diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb index d761d5b8e..c625f73fa 100644 --- a/test/functional/my_controller_test.rb +++ b/test/functional/my_controller_test.rb @@ -365,9 +365,11 @@ class MyControllerTest < Redmine::ControllerTest def test_my_account_with_avatar_enabled_should_link_to_edit_avatar with_settings :gravatar_enabled => '1' do - get :account - assert_response :success - assert_select 'a[href=?] img.gravatar', 'https://gravatar.com' + Redmine::Configuration.with 'avatar_server_url' => 'https://gravatar.com' do + get :account + assert_response :success + assert_select 'a[href=?] img.gravatar', 'https://gravatar.com' + end end end diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index 74acae4b0..b91012b58 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -1529,6 +1529,21 @@ RAW end end + def test_avatar_server_url + to_test = { + 'https://www.gravatar.com' => %r|https://www.gravatar.com/avatar/\h{32}|, + 'https://seccdn.libravatar.org' => %r|https://seccdn.libravatar.org/avatar/\h{32}|, + 'http://localhost:8080' => %r|http://localhost:8080/avatar/\h{32}|, + } + with_settings :gravatar_enabled => '1' do + to_test.each do |url, expected| + Redmine::Configuration.with 'avatar_server_url' => url do + assert_match expected, avatar('<jsmith@somenet.foo>') + end + end + end + end + def test_link_to_user user = User.find(2) result = link_to("John Smith", "/users/2", :class => "user active") |