Actualizar plugin Additionals a 3.0.0
This commit is contained in:
parent
3d976f1b3b
commit
a26f5567af
399 changed files with 70374 additions and 4093 deletions
|
@ -1,7 +1,13 @@
|
|||
require File.expand_path('../../test_helper', __FILE__)
|
||||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class AccountControllerTest < Additionals::ControllerTest
|
||||
fixtures :users, :email_addresses, :roles
|
||||
fixtures :users, :groups_users, :email_addresses, :user_preferences,
|
||||
:roles, :members, :member_roles,
|
||||
:issues, :issue_statuses, :issue_relations,
|
||||
:issues, :issue_statuses, :issue_categories,
|
||||
:versions, :trackers,
|
||||
:projects, :projects_trackers, :enabled_modules,
|
||||
:enumerations
|
||||
|
||||
def setup
|
||||
Setting.default_language = 'en'
|
||||
|
@ -9,23 +15,23 @@ class AccountControllerTest < Additionals::ControllerTest
|
|||
end
|
||||
|
||||
def test_get_login_with_welcome_text
|
||||
with_additionals_settings(account_login_bottom: 'Lore impsuum') do
|
||||
get :login
|
||||
assert_response :success
|
||||
assert_select 'input[name=username]'
|
||||
assert_select 'input[name=password]'
|
||||
assert_select 'div.login-additionals', text: /Lore impsuum/
|
||||
end
|
||||
change_additionals_settings account_login_bottom: 'Lore impsuum'
|
||||
|
||||
get :login
|
||||
assert_response :success
|
||||
assert_select 'input[name=username]'
|
||||
assert_select 'input[name=password]'
|
||||
assert_select 'div.login-additionals', text: /Lore impsuum/
|
||||
end
|
||||
|
||||
def test_get_login_without_welcome_text
|
||||
with_additionals_settings(account_login_bottom: '') do
|
||||
get :login
|
||||
assert_response :success
|
||||
assert_select 'input[name=username]'
|
||||
assert_select 'input[name=password]'
|
||||
assert_select 'div.login-additionals', count: 0
|
||||
end
|
||||
change_additionals_settings account_login_bottom: ''
|
||||
|
||||
get :login
|
||||
assert_response :success
|
||||
assert_select 'input[name=username]'
|
||||
assert_select 'input[name=password]'
|
||||
assert_select 'div.login-additionals', count: 0
|
||||
end
|
||||
|
||||
# See integration/account_test.rb for the full test
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require File.expand_path('../../test_helper', __FILE__)
|
||||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class AdditionalsAssignToMeControllerTest < Additionals::ControllerTest
|
||||
fixtures :projects,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require File.expand_path('../../test_helper', __FILE__)
|
||||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class AdditionalsChangeStatusControllerTest < Additionals::ControllerTest
|
||||
fixtures :projects,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require File.expand_path('../../test_helper', __FILE__)
|
||||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class AdditionalsMacrosControllerTest < Additionals::ControllerTest
|
||||
fixtures :projects,
|
||||
|
@ -24,6 +24,6 @@ class AdditionalsMacrosControllerTest < Additionals::ControllerTest
|
|||
@request.session[:user_id] = nil
|
||||
get :show
|
||||
|
||||
assert_response 302
|
||||
assert_response :redirect
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class AutoCompletesControllerTest < Additionals::ControllerTest
|
||||
fixtures :projects, :email_addresses,
|
||||
:enumerations, :users, :groups_users,
|
||||
:roles,
|
||||
:members, :member_roles,
|
||||
:enabled_modules
|
||||
|
||||
def test_fontawesome_default
|
||||
get :fontawesome
|
||||
|
||||
assert_response :success
|
||||
json = ActiveSupport::JSON.decode(response.body)
|
||||
assert_kind_of Array, json
|
||||
icon = json.first
|
||||
assert_kind_of Hash, icon
|
||||
assert_equal 'far_address-book', icon['id']
|
||||
assert_equal 'Address Book', icon['text']
|
||||
end
|
||||
|
||||
def test_fontawesome_search
|
||||
get :fontawesome,
|
||||
params: { q: 'sun' }
|
||||
|
||||
assert_response :success
|
||||
json = ActiveSupport::JSON.decode(response.body)
|
||||
assert_kind_of Array, json
|
||||
assert_equal 5, json.count
|
||||
icon = json.first
|
||||
assert_kind_of Hash, icon
|
||||
assert_equal 'fas_cloud-sun', icon['id']
|
||||
assert_equal 'Cloud with Sun', icon['text']
|
||||
end
|
||||
|
||||
def test_fontawesome_search_without_result
|
||||
get :fontawesome,
|
||||
params: { q: 'doesnotexist' }
|
||||
|
||||
assert_response :success
|
||||
json = ActiveSupport::JSON.decode(response.body)
|
||||
assert_kind_of Array, json
|
||||
assert_equal 0, json.count
|
||||
end
|
||||
end
|
|
@ -0,0 +1,36 @@
|
|||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class DashboardAsyncBlocksControllerTest < Additionals::ControllerTest
|
||||
fixtures :projects,
|
||||
:users,
|
||||
:roles,
|
||||
:members,
|
||||
:member_roles,
|
||||
:issues,
|
||||
:issue_statuses,
|
||||
:versions,
|
||||
:trackers,
|
||||
:projects_trackers,
|
||||
:issue_categories,
|
||||
:enabled_modules,
|
||||
:dashboards, :dashboard_roles,
|
||||
:queries
|
||||
|
||||
include Redmine::I18n
|
||||
|
||||
def setup
|
||||
prepare_tests
|
||||
Setting.default_language = 'en'
|
||||
|
||||
@project = projects :projects_001
|
||||
@welcome_dashboard = dashboards :system_default_welcome
|
||||
@project_dashboard = dashboards :system_default_project
|
||||
end
|
||||
|
||||
def test_query_blocks
|
||||
assert_dashboard_query_blocks [
|
||||
{ dashboard_id: @welcome_dashboard.id, block: 'issuequery', entities_class: 'issues' },
|
||||
{ dashboard_id: @project_dashboard.id, block: 'issuequery', project: @project, entities_class: 'issues' }
|
||||
]
|
||||
end
|
||||
end
|
|
@ -0,0 +1,33 @@
|
|||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class DashboardsControllerTest < Additionals::ControllerTest
|
||||
fixtures :projects,
|
||||
:users,
|
||||
:roles,
|
||||
:members,
|
||||
:member_roles,
|
||||
:issues,
|
||||
:issue_statuses,
|
||||
:versions,
|
||||
:trackers,
|
||||
:projects_trackers,
|
||||
:issue_categories,
|
||||
:enabled_modules,
|
||||
:dashboards, :dashboard_roles,
|
||||
:queries
|
||||
|
||||
def setup
|
||||
prepare_tests
|
||||
@request.session[:user_id] = 2
|
||||
end
|
||||
|
||||
def test_create
|
||||
assert_difference 'Dashboard.count', 1 do
|
||||
post :create,
|
||||
params: { dashboard: { name: 'my test dashboard',
|
||||
dashboard_type: DashboardContentWelcome::TYPE_NAME,
|
||||
description: 'test desc',
|
||||
author_id: 2 } }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,34 +1,24 @@
|
|||
require File.expand_path('../../test_helper', __FILE__)
|
||||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class IssuesControllerTest < Additionals::ControllerTest
|
||||
fixtures :projects,
|
||||
:users, :email_addresses, :user_preferences,
|
||||
:roles,
|
||||
:members,
|
||||
:member_roles,
|
||||
:issues,
|
||||
:issue_statuses,
|
||||
:issue_relations,
|
||||
fixtures :users, :email_addresses, :roles,
|
||||
:enumerations,
|
||||
:projects, :projects_trackers, :enabled_modules,
|
||||
:members, :member_roles,
|
||||
:issues, :issue_statuses, :issue_categories, :issue_relations,
|
||||
:versions,
|
||||
:trackers,
|
||||
:projects_trackers,
|
||||
:issue_categories,
|
||||
:enabled_modules,
|
||||
:enumerations,
|
||||
:attachments,
|
||||
:workflows,
|
||||
:custom_fields,
|
||||
:custom_values,
|
||||
:custom_fields_projects,
|
||||
:custom_fields_trackers,
|
||||
:custom_fields, :custom_values, :custom_fields_projects, :custom_fields_trackers,
|
||||
:time_entries,
|
||||
:journals,
|
||||
:journal_details,
|
||||
:watchers,
|
||||
:journals, :journal_details,
|
||||
:repositories, :changesets,
|
||||
:queries
|
||||
|
||||
def setup
|
||||
manager_role = roles(:roles_001)
|
||||
manager_role.add_permission!(:edit_issue_author)
|
||||
manager_role = roles :roles_001
|
||||
manager_role.add_permission! :edit_issue_author
|
||||
end
|
||||
|
||||
test 'author field as authorized user in new with change' do
|
||||
|
@ -135,7 +125,6 @@ class IssuesControllerTest < Additionals::ControllerTest
|
|||
issue_timelog_required: 1,
|
||||
issue_timelog_required_tracker: ['1'],
|
||||
issue_timelog_required_status: ['5']) do
|
||||
|
||||
@request.session[:user_id] = 2
|
||||
issue = Issue.generate!(tracker_id: 1, status_id: 1)
|
||||
get :show,
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
require File.expand_path('../../test_helper', __FILE__)
|
||||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class ViewDashboardTopRenderOn < Redmine::Hook::ViewListener
|
||||
render_on :view_dashboard_top, inline: '<div class="test">Example text</div>'
|
||||
end
|
||||
|
||||
class ViewDashboardBottomRenderOn < Redmine::Hook::ViewListener
|
||||
render_on :view_dashboard_bottom, inline: '<div class="test">Example text</div>'
|
||||
end
|
||||
|
||||
class ProjectsControllerTest < Additionals::ControllerTest
|
||||
fixtures :projects,
|
||||
|
@ -12,32 +20,65 @@ class ProjectsControllerTest < Additionals::ControllerTest
|
|||
:trackers,
|
||||
:projects_trackers,
|
||||
:issue_categories,
|
||||
:enabled_modules
|
||||
:enabled_modules,
|
||||
:dashboards, :dashboard_roles
|
||||
|
||||
def setup
|
||||
Setting.default_language = 'en'
|
||||
User.current = nil
|
||||
end
|
||||
|
||||
def test_show_overview_content
|
||||
with_additionals_settings(project_overview_content: 'Lore impsuum') do
|
||||
@request.session[:user_id] = 4
|
||||
get :show,
|
||||
params: { id: 1 }
|
||||
def test_show_with_left_text_block
|
||||
@request.session[:user_id] = 4
|
||||
get :show,
|
||||
params: { id: 1 }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.project-content', text: /Lore impsuum/
|
||||
end
|
||||
assert_response :success
|
||||
assert_select 'div#list-left div#block-text', text: /example text/
|
||||
end
|
||||
|
||||
def test_do_not_show_overview_content_box
|
||||
with_additionals_settings(project_overview_content: '') do
|
||||
@request.session[:user_id] = 4
|
||||
get :show,
|
||||
params: { id: 1 }
|
||||
def test_show_with_right_text_block
|
||||
@request.session[:user_id] = 4
|
||||
get :show,
|
||||
params: { id: 1 }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.project-content', count: 0
|
||||
end
|
||||
assert_response :success
|
||||
assert_select 'div#list-right div#block-text__1', text: /example text/
|
||||
end
|
||||
|
||||
def test_show_with_hook_view_dashboard_top
|
||||
Redmine::Hook.add_listener ViewDashboardTopRenderOn
|
||||
@request.session[:user_id] = 4
|
||||
get :show,
|
||||
params: { id: 1 }
|
||||
|
||||
assert_select 'div.test', text: 'Example text'
|
||||
end
|
||||
|
||||
def test_show_with_hook_view_dashboard_bottom
|
||||
Redmine::Hook.add_listener ViewDashboardBottomRenderOn
|
||||
@request.session[:user_id] = 4
|
||||
get :show,
|
||||
params: { id: 1 }
|
||||
|
||||
assert_select 'div.test', text: 'Example text'
|
||||
end
|
||||
|
||||
def test_show_with_invalid_dashboard
|
||||
get :show,
|
||||
params: { id: 1,
|
||||
dashboard_id: 444 }
|
||||
|
||||
assert_response :missing
|
||||
end
|
||||
|
||||
def test_show_dashboard_without_permission
|
||||
@request.session[:user_id] = 3
|
||||
|
||||
get :show,
|
||||
params: { id: 1,
|
||||
dashboard_id: dashboards(:private_project2) }
|
||||
|
||||
assert_response :forbidden
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,41 +1,66 @@
|
|||
require File.expand_path('../../test_helper', __FILE__)
|
||||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class ViewUsersShowContextualRenderOn < Redmine::Hook::ViewListener
|
||||
render_on :view_users_show_contextual, inline: '<div class="test">Example text</div>'
|
||||
end
|
||||
|
||||
class ViewUsersShowInfoRenderOn < Redmine::Hook::ViewListener
|
||||
render_on :view_users_show_info, inline: '<div class="test">Example text</div>'
|
||||
end
|
||||
|
||||
class UsersControllerTest < Additionals::ControllerTest
|
||||
fixtures :projects,
|
||||
:users,
|
||||
:roles,
|
||||
:members,
|
||||
:member_roles,
|
||||
:issues,
|
||||
:issue_statuses,
|
||||
:versions,
|
||||
:trackers,
|
||||
:projects_trackers,
|
||||
:issue_categories,
|
||||
:enabled_modules
|
||||
fixtures :users, :groups_users, :email_addresses, :user_preferences,
|
||||
:roles, :members, :member_roles,
|
||||
:issues, :issue_statuses, :issue_relations,
|
||||
:issues, :issue_statuses, :issue_categories,
|
||||
:versions, :trackers,
|
||||
:projects, :projects_trackers, :enabled_modules,
|
||||
:enumerations
|
||||
|
||||
include Redmine::I18n
|
||||
|
||||
def setup
|
||||
prepare_tests
|
||||
@controller = UsersController.new
|
||||
User.current = nil
|
||||
end
|
||||
|
||||
def test_show_with_hook_view_users_show_contextual
|
||||
Redmine::Hook.add_listener ViewUsersShowContextualRenderOn
|
||||
@request.session[:user_id] = 4
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.test', text: 'Example text'
|
||||
end
|
||||
|
||||
def test_show_with_hook_view_users_show_info
|
||||
Redmine::Hook.add_listener ViewUsersShowInfoRenderOn
|
||||
@request.session[:user_id] = 4
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.test', text: 'Example text'
|
||||
end
|
||||
|
||||
def test_show_new_issue_on_profile
|
||||
with_additionals_settings(new_issue_on_profile: 1) do
|
||||
with_additionals_settings new_issue_on_profile: 1 do
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'a.user-new-issue'
|
||||
end
|
||||
end
|
||||
|
||||
def test_not_show_new_issue_on_profile_without_activated
|
||||
with_additionals_settings(new_issue_on_profile: 0) do
|
||||
with_additionals_settings new_issue_on_profile: 0 do
|
||||
@request.session[:user_id] = 2
|
||||
get :show,
|
||||
params: { id: 2 }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'a.user-new-issue', count: 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,74 +1,81 @@
|
|||
require File.expand_path('../../test_helper', __FILE__)
|
||||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class ViewWelcomeIndexTopRenderOn < Redmine::Hook::ViewListener
|
||||
render_on :view_welcome_index_top, inline: '<div class="test">Example text</div>'
|
||||
end
|
||||
|
||||
class ViewWelcomeIndexBottomRenderOn < Redmine::Hook::ViewListener
|
||||
render_on :view_welcome_index_bottom, inline: '<div class="test">Example text</div>'
|
||||
end
|
||||
|
||||
class ViewDashboardTopRenderOn < Redmine::Hook::ViewListener
|
||||
render_on :view_dashboard_top, inline: '<div class="test">Example text</div>'
|
||||
end
|
||||
|
||||
class ViewDashboardBottomRenderOn < Redmine::Hook::ViewListener
|
||||
render_on :view_dashboard_bottom, inline: '<div class="test">Example text</div>'
|
||||
end
|
||||
|
||||
class WelcomeControllerTest < Additionals::ControllerTest
|
||||
fixtures :projects, :news, :users, :members
|
||||
fixtures :projects, :news, :users, :members,
|
||||
:dashboards, :dashboard_roles
|
||||
|
||||
def setup
|
||||
Setting.default_language = 'en'
|
||||
User.current = nil
|
||||
end
|
||||
|
||||
def test_show_with_overview_right
|
||||
with_additionals_settings(overview_right: 'Lore impsuum') do
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
def test_show_with_left_text_block
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.overview-right', text: /Lore impsuum/
|
||||
end
|
||||
assert_response :success
|
||||
assert_select 'div#list-left div#block-text', text: /example text/
|
||||
end
|
||||
|
||||
def test_show_without_overview_right
|
||||
with_additionals_settings(overview_right: '') do
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
def test_show_with_right_text_block
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.overview-right', count: 0
|
||||
end
|
||||
assert_response :success
|
||||
assert_select 'div#list-right div#block-text__1', text: /example text/
|
||||
end
|
||||
|
||||
def test_show_with_overview_bottom
|
||||
with_additionals_settings(overview_bottom: 'Lore impsuum') do
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
def test_show_with_hook_view_welcome_index_top
|
||||
Redmine::Hook.add_listener ViewWelcomeIndexTopRenderOn
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.overview-bottom', text: /Lore impsuum/
|
||||
end
|
||||
assert_select 'div.test', text: 'Example text'
|
||||
end
|
||||
|
||||
def test_show_without_overview_bottom
|
||||
with_additionals_settings(overview_bottom: '') do
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
def test_show_with_hook_view_welcome_index_bottom
|
||||
Redmine::Hook.add_listener ViewWelcomeIndexBottomRenderOn
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.overview-bottom', count: 0
|
||||
end
|
||||
assert_select 'div.test', text: 'Example text'
|
||||
end
|
||||
|
||||
def test_show_with_overview_top
|
||||
with_additionals_settings(overview_top: 'Lore impsuum') do
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
def test_show_with_hook_view_dashboard_top
|
||||
Redmine::Hook.add_listener ViewDashboardTopRenderOn
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.overview-top', text: /Lore impsuum/
|
||||
end
|
||||
assert_select 'div.test', text: 'Example text'
|
||||
end
|
||||
|
||||
def test_show_without_overview_top
|
||||
with_additionals_settings(overview_top: '') do
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
def test_show_with_hook_view_dashboard_bottom
|
||||
Redmine::Hook.add_listener ViewDashboardBottomRenderOn
|
||||
@request.session[:user_id] = 4
|
||||
get :index
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div.overview-top', count: 0
|
||||
end
|
||||
assert_select 'div.test', text: 'Example text'
|
||||
end
|
||||
|
||||
def test_show_index_with_help_menu
|
||||
skip if Redmine::Plugin.installed?('redmine_hrm')
|
||||
|
||||
with_additionals_settings(remove_help: 0) do
|
||||
@request.session[:user_id] = 1
|
||||
get :index
|
||||
|
@ -78,6 +85,8 @@ class WelcomeControllerTest < Additionals::ControllerTest
|
|||
end
|
||||
|
||||
def test_show_index_without_help_menu
|
||||
skip if Redmine::Plugin.installed?('redmine_hrm')
|
||||
|
||||
with_additionals_settings(remove_help: 1) do
|
||||
@request.session[:user_id] = 1
|
||||
get :index
|
||||
|
@ -85,4 +94,11 @@ class WelcomeControllerTest < Additionals::ControllerTest
|
|||
assert_select 'div#top-menu a.help', count: 0
|
||||
end
|
||||
end
|
||||
|
||||
def test_index_with_invalid_dashboard
|
||||
get :index,
|
||||
params: { dashboard_id: 444 }
|
||||
|
||||
assert_response :missing
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require File.expand_path('../../test_helper', __FILE__)
|
||||
require File.expand_path '../../test_helper', __FILE__
|
||||
|
||||
class WikiControllerTest < Additionals::ControllerTest
|
||||
fixtures :projects,
|
||||
|
@ -25,7 +25,7 @@ class WikiControllerTest < Additionals::ControllerTest
|
|||
def setup
|
||||
prepare_tests
|
||||
EnabledModule.create(project_id: 1, name: 'wiki')
|
||||
@project = projects(:projects_001)
|
||||
@project = projects :projects_001
|
||||
@wiki = @project.wiki
|
||||
@page_name = 'additionals_macro_test'
|
||||
@page = @wiki.find_or_new_page(@page_name)
|
||||
|
@ -51,7 +51,7 @@ class WikiControllerTest < Additionals::ControllerTest
|
|||
get :show,
|
||||
params: { project_id: 1, id: @page_name }
|
||||
assert_response :success
|
||||
assert_select 'iframe', src: %r{^https\://www\.meteoblue\.com/en/weather/widget/daily/(.*)}
|
||||
assert_select 'iframe', src: %r{^https://www\.meteoblue\.com/en/weather/widget/daily/(.*)}
|
||||
end
|
||||
|
||||
def test_show_with_vimeo_macro
|
||||
|
@ -74,6 +74,16 @@ class WikiControllerTest < Additionals::ControllerTest
|
|||
assert_select 'iframe[src=?]', '//www.slideshare.net/slideshow/embed_code/57941706'
|
||||
end
|
||||
|
||||
def test_show_with_google_docs_macro
|
||||
@request.session[:user_id] = WIKI_MACRO_USER_ID
|
||||
@page.content.text = '{{google_docs(https://docs.google.com/spreadsheets/d/e/RANDOMCODE/pubhtml)}}'
|
||||
@page.content.save!
|
||||
get :show,
|
||||
params: { project_id: 1, id: @page_name }
|
||||
assert_response :success
|
||||
assert_select 'iframe[src=?]', 'https://docs.google.com/spreadsheets/d/e/RANDOMCODE/pubhtml?widget=true&headers=false'
|
||||
end
|
||||
|
||||
def test_show_with_iframe_macro
|
||||
@request.session[:user_id] = WIKI_MACRO_USER_ID
|
||||
@page.content.text = '{{iframe(https://www.redmine.org/)}}'
|
||||
|
@ -173,16 +183,6 @@ class WikiControllerTest < Additionals::ControllerTest
|
|||
assert_select 'div.recently-updated'
|
||||
end
|
||||
|
||||
def test_show_calendar_macro
|
||||
@request.session[:user_id] = WIKI_MACRO_USER_ID
|
||||
@page.content.text = '{{calendar(year=1970, month=7)}}'
|
||||
@page.content.save!
|
||||
get :show,
|
||||
params: { project_id: 1, id: @page_name }
|
||||
assert_response :success
|
||||
assert_select 'div.month-calendar'
|
||||
end
|
||||
|
||||
def test_show_with_members_macro
|
||||
@request.session[:user_id] = WIKI_MACRO_USER_ID
|
||||
@page.content.text = '{{members}}'
|
||||
|
@ -220,7 +220,7 @@ class WikiControllerTest < Additionals::ControllerTest
|
|||
get :show,
|
||||
params: { project_id: 1, id: @page_name }
|
||||
assert_response :success
|
||||
assert_select 'div.wiki div.additionals-projects li.project'
|
||||
assert_select 'div.wiki div.additionals-projects tr.project'
|
||||
end
|
||||
|
||||
def test_show_with_fa_macro
|
||||
|
@ -301,7 +301,7 @@ class WikiControllerTest < Additionals::ControllerTest
|
|||
params: { project_id: 1, id: @page_name }
|
||||
assert_response :success
|
||||
assert_select 'div.wiki div.cryptocompare',
|
||||
text: %r{https:\/\/widgets\.cryptocompare\.com\/serve\/v3\/coin\/header\?fsyms=BTC,ETH&tsyms=EUR}
|
||||
text: %r{https://widgets\.cryptocompare\.com/serve/v3/coin/header\?fsyms=BTC,ETH&tsyms=EUR}
|
||||
end
|
||||
|
||||
def test_show_with_date_macro
|
||||
|
@ -366,6 +366,16 @@ class WikiControllerTest < Additionals::ControllerTest
|
|||
assert_select 'div.flash.error', html: /Error executing/
|
||||
end
|
||||
|
||||
def test_show_with_asciinema_macro
|
||||
@request.session[:user_id] = WIKI_MACRO_USER_ID
|
||||
@page.content.text = '{{asciinema(113463)}}'
|
||||
@page.content.save!
|
||||
get :show,
|
||||
params: { project_id: 1, id: @page_name }
|
||||
assert_response :success
|
||||
assert_select 'script[src=?]', '//asciinema.org/a/113463.js'
|
||||
end
|
||||
|
||||
def test_show_issue
|
||||
@request.session[:user_id] = WIKI_MACRO_USER_ID
|
||||
@page.content.text = '{{issue(2, format=short)}}'
|
||||
|
@ -468,44 +478,4 @@ class WikiControllerTest < Additionals::ControllerTest
|
|||
assert_select 'a[href=?]', '/users/2',
|
||||
text: 'John Smith'
|
||||
end
|
||||
|
||||
def test_show_wiki_with_header
|
||||
with_additionals_settings(global_wiki_header: 'Lore impsuum') do
|
||||
get :show,
|
||||
params: { project_id: 1, id: 'Another_page' }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div#wiki_extentions_header', text: /Lore impsuum/
|
||||
end
|
||||
end
|
||||
|
||||
def test_show_wiki_without_header
|
||||
with_additionals_settings(global_wiki_header: '') do
|
||||
get :show,
|
||||
params: { project_id: 1, id: 'Another_page' }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div#wiki_extentions_header', count: 0
|
||||
end
|
||||
end
|
||||
|
||||
def test_show_wiki_with_footer
|
||||
with_additionals_settings(global_wiki_footer: 'Lore impsuum') do
|
||||
get :show,
|
||||
params: { project_id: 1, id: 'Another_page' }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div#wiki_extentions_footer', text: /Lore impsuum/
|
||||
end
|
||||
end
|
||||
|
||||
def test_show_wiki_without_footer
|
||||
with_additionals_settings(global_wiki_footer: '') do
|
||||
get :show,
|
||||
params: { project_id: 1, id: 'Another_page' }
|
||||
|
||||
assert_response :success
|
||||
assert_select 'div#wiki_extentions_footer', count: 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue