summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/calendars_controller_test.rb2
-rw-r--r--test/functional/gantts_controller_test.rb2
-rw-r--r--test/functional/issues_controller_test.rb27
-rw-r--r--test/functional/messages_controller_test.rb2
-rw-r--r--test/functional/news_controller_test.rb2
-rw-r--r--test/helpers/application_helper_test.rb14
-rw-r--r--test/helpers/avatars_helper_test.rb10
-rw-r--r--test/integration/api_test/authentication_test.rb8
8 files changed, 27 insertions, 40 deletions
diff --git a/test/functional/calendars_controller_test.rb b/test/functional/calendars_controller_test.rb
index 227919435..202c076ac 100644
--- a/test/functional/calendars_controller_test.rb
+++ b/test/functional/calendars_controller_test.rb
@@ -57,7 +57,7 @@ class CalendarsControllerTest < Redmine::ControllerTest
) do
assert_select 'a.issue[href=?]', '/issues/2', :text => 'Feature request #2'
assert_select 'span.tip' do
- assert_select 'img[class="gravatar"]'
+ assert_select 'img[class="gravatar avatar"]'
end
assert_select 'input[name=?][type=?][value=?]', 'ids[]', 'checkbox', '2'
end
diff --git a/test/functional/gantts_controller_test.rb b/test/functional/gantts_controller_test.rb
index daba816b8..73a74ba65 100644
--- a/test/functional/gantts_controller_test.rb
+++ b/test/functional/gantts_controller_test.rb
@@ -58,7 +58,7 @@ class GanttsControllerTest < Redmine::ControllerTest
# Assert context menu on issues subject and gantt bar
assert_select 'div[class=?]', 'issue-subject hascontextmenu'
assert_select 'div.tooltip.hascontextmenu' do
- assert_select 'img[class="gravatar"]'
+ assert_select 'img[class="gravatar avatar"]'
end
assert_select "form[data-cm-url=?]", '/issues/context_menu'
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index d19c09f33..4b9b44537 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -2816,7 +2816,7 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'h3', {text: /Watchers \(\d*\)/, count: 0}
end
- def test_show_should_display_watchers_with_gravatars
+ def test_show_should_display_watchers_with_avatars
@request.session[:user_id] = 2
issue = Issue.find(1)
issue.add_watcher User.find(2)
@@ -2824,9 +2824,10 @@ class IssuesControllerTest < Redmine::ControllerTest
with_settings :gravatar_enabled => '1' do
get(:show, :params => {:id => 1})
end
+
assert_select 'div#watchers ul' do
assert_select 'li.user-2' do
- assert_select 'img.gravatar[title=?]', 'John Smith'
+ assert_select '.avatar[title=?]', 'John Smith'
assert_select 'a[href="/users/2"]'
assert_select 'a[class*=delete]'
end
@@ -8786,31 +8787,27 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'a[href=?][onclick=?]', "/issues/1", "", :text => 'Cancel'
end
- def test_show_should_display_author_gravatar_only_when_not_assigned
+ def test_show_should_display_author_avatar_only_when_not_assigned
issue = Issue.find(1)
assert_nil issue.assigned_to_id
@request.session[:user_id] = 1
- with_settings :gravatar_enabled => '1' do
- get :show, :params => {:id => issue.id}
- assert_select 'div.gravatar-with-child' do
- assert_select 'img.gravatar', 1
- end
+ get :show, :params => {:id => issue.id}
+ assert_select 'div.avatar-with-child' do
+ assert_select '.avatar', 1
end
end
- def test_show_should_display_author_and_assignee_gravatars_when_assigned
+ def test_show_should_display_author_and_assignee_avatars_when_assigned
issue = Issue.find(1)
issue.assigned_to_id = 2
issue.save!
@request.session[:user_id] = 1
- with_settings :gravatar_enabled => '1' do
- get :show, :params => {:id => issue.id}
- assert_select 'div.gravatar-with-child' do
- assert_select 'img.gravatar', 2
- assert_select 'img.gravatar-child', 1
- end
+ get :show, :params => {:id => issue.id}
+ assert_select 'div.avatar-with-child' do
+ assert_select '.avatar', 2
+ assert_select '.avatar-child', 1
end
end
diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb
index 997b2263a..cec58ff5f 100644
--- a/test/functional/messages_controller_test.rb
+++ b/test/functional/messages_controller_test.rb
@@ -28,7 +28,7 @@ class MessagesControllerTest < Redmine::ControllerTest
get(:show, :params => {:board_id => 1, :id => 1})
assert_response :success
- assert_select 'h2', :text => 'First post'
+ assert_select 'h2', :text => "RAFirst post"
end
def test_show_should_contain_reply_field_tags_for_quoting
diff --git a/test/functional/news_controller_test.rb b/test/functional/news_controller_test.rb
index 536814c9d..686fada25 100644
--- a/test/functional/news_controller_test.rb
+++ b/test/functional/news_controller_test.rb
@@ -75,7 +75,7 @@ class NewsControllerTest < Redmine::ControllerTest
get(:show, :params => {:id => 1})
assert_response :success
assert_select 'p.breadcrumb a[href=?]', '/projects/ecookbook/news', :text => 'News'
- assert_select 'h2', :text => 'eCookbook first release !'
+ assert_select 'h2', :text => 'JS eCookbook first release !'
end
def test_show_should_show_attachments
diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb
index 2e2e8b933..1f60bbbe2 100644
--- a/test/helpers/application_helper_test.rb
+++ b/test/helpers/application_helper_test.rb
@@ -2053,20 +2053,6 @@ class ApplicationHelperTest < Redmine::HelperTest
end
end
- def test_principals_check_box_tag_without_avatar
- principals = [User.find(1), Group.find(10)]
- Setting.gravatar_enabled = '1'
- avatar_tags = principals.collect{|p| avatar(p, :size => 16)}
-
- with_settings :gravatar_enabled => '0' do
- tags = principals_check_box_tags(name, principals)
- principals.each_with_index do |principal, i|
- assert_not_include avatar_tags[i], tags
- assert_include content_tag('span', principal_icon(principal), :class => "name icon icon-#{principal.class.name.downcase}"), tags
- end
- end
- end
-
def test_principals_options_for_select_with_users
User.current = nil
users = [User.find(2), User.find(4)]
diff --git a/test/helpers/avatars_helper_test.rb b/test/helpers/avatars_helper_test.rb
index baa64a653..6b426bc98 100644
--- a/test/helpers/avatars_helper_test.rb
+++ b/test/helpers/avatars_helper_test.rb
@@ -63,9 +63,9 @@ class AvatarsHelperTest < Redmine::HelperTest
end
def test_avatar_css_class
- # The default class of the img tag should be gravatar
- assert_include 'class="gravatar"', avatar('jsmith <jsmith@somenet.foo>')
- assert_include 'class="gravatar picture"', avatar('jsmith <jsmith@somenet.foo>', :class => 'picture')
+ # The default classes of the img tag should be gravatar and avatar
+ assert_include 'class="gravatar avatar"', avatar('jsmith <jsmith@somenet.foo>')
+ assert_include 'class="gravatar avatar picture"', avatar('jsmith <jsmith@somenet.foo>', :class => 'picture')
end
def test_avatar_with_initials
@@ -80,9 +80,9 @@ class AvatarsHelperTest < Redmine::HelperTest
end
end
- def test_avatar_disabled
+ def test_avatar_disabled_should_display_user_initials
with_settings :gravatar_enabled => '0' do
- assert_equal '', avatar(User.find_by_mail('jsmith@somenet.foo'))
+ assert_equal "<span role=\"img\" class=\"avatar-color-2 avatar s24\">JS</span>", avatar(User.find_by_mail('jsmith@somenet.foo'))
end
end
diff --git a/test/integration/api_test/authentication_test.rb b/test/integration/api_test/authentication_test.rb
index 23641b53a..4145fb969 100644
--- a/test/integration/api_test/authentication_test.rb
+++ b/test/integration/api_test/authentication_test.rb
@@ -127,20 +127,23 @@ class Redmine::ApiTest::AuthenticationTest < Redmine::ApiTest::Base
assert_response :unauthorized
end
+ # TODO: check why this test does not use the API endpoint
def test_api_should_accept_switch_user_header_for_admin_user
user = User.find(1)
su = User.find(4)
get '/users/current', :headers => {'X-Redmine-API-Key' => user.api_key, 'X-Redmine-Switch-User' => su.login}
assert_response :success
- assert_select 'h2', :text => su.name
+ assert_select 'h2', :text => "#{su.initials} #{su.name}"
end
+ # TODO: check why this test does not use the API endpoint
def test_api_should_respond_with_412_when_trying_to_switch_to_a_invalid_user
get '/users/current', :headers => {'X-Redmine-API-Key' => User.find(1).api_key, 'X-Redmine-Switch-User' => 'foobar'}
assert_response :precondition_failed
end
+ # TODO: check why this test does not use the API endpoint
def test_api_should_respond_with_412_when_trying_to_switch_to_a_locked_user
user = User.find(5)
assert user.locked?
@@ -149,12 +152,13 @@ class Redmine::ApiTest::AuthenticationTest < Redmine::ApiTest::Base
assert_response :precondition_failed
end
+ # TODO: check why this test does not use the API endpoint
def test_api_should_not_accept_switch_user_header_for_non_admin_user
user = User.find(2)
su = User.find(4)
get '/users/current', :headers => {'X-Redmine-API-Key' => user.api_key, 'X-Redmine-Switch-User' => su.login}
assert_response :success
- assert_select 'h2', :text => user.name
+ assert_select 'h2', :text => "#{user.initials} #{user.name}"
end
end