2025-05-05 09:29:55 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2013-06-28 15:01:17 +02:00
|
|
|
#-- copyright
|
2020-01-15 11:31:26 +01:00
|
|
|
# OpenProject is an open source project management software.
|
2024-07-30 13:42:36 +02:00
|
|
|
# Copyright (C) the OpenProject GmbH
|
2013-06-28 15:01:17 +02:00
|
|
|
#
|
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
|
# modify it under the terms of the GNU General Public License version 3.
|
|
|
|
|
#
|
2013-09-16 17:59:31 +02:00
|
|
|
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
2021-01-13 17:47:45 +01:00
|
|
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
2013-09-16 17:59:31 +02:00
|
|
|
# Copyright (C) 2010-2013 the ChiliProject Team
|
|
|
|
|
#
|
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
#
|
2021-09-02 21:49:06 +02:00
|
|
|
# See COPYRIGHT and LICENSE files for more details.
|
2013-06-28 15:01:17 +02:00
|
|
|
#++
|
|
|
|
|
|
2013-07-31 11:44:22 +02:00
|
|
|
require "spec_helper"
|
2013-06-28 15:01:17 +02:00
|
|
|
|
2023-05-31 12:15:15 +02:00
|
|
|
RSpec.describe WorkPackagesController do
|
2013-06-28 15:01:17 +02:00
|
|
|
before do
|
2020-04-20 16:16:01 +02:00
|
|
|
login_as current_user
|
2013-07-11 15:28:51 +02:00
|
|
|
end
|
|
|
|
|
|
2022-01-24 19:22:35 +01:00
|
|
|
let(:project) { create(:project, identifier: "test_project", public: false) }
|
2023-09-27 18:07:01 +02:00
|
|
|
let(:other_project) { build_stubbed(:project) }
|
2026-04-10 19:32:29 +03:00
|
|
|
let(:type) { create(:type) }
|
|
|
|
|
let(:work_package) { create(:work_package, type:, project:) }
|
2013-07-03 15:07:19 +02:00
|
|
|
|
2022-01-24 19:22:35 +01:00
|
|
|
let(:current_user) { create(:user) }
|
2013-06-28 22:23:41 +02:00
|
|
|
|
2013-08-05 18:03:40 +02:00
|
|
|
def self.requires_permission_in_project(&)
|
|
|
|
|
describe "w/o the permission to see the project/work_package" do
|
|
|
|
|
before do
|
2014-03-29 14:50:29 +01:00
|
|
|
allow(controller).to receive(:work_package).and_return(nil)
|
2013-06-28 15:01:17 +02:00
|
|
|
|
2013-08-05 18:03:40 +02:00
|
|
|
call_action
|
2013-06-28 15:01:17 +02:00
|
|
|
end
|
|
|
|
|
|
2019-09-04 11:21:18 +02:00
|
|
|
it "renders a 404" do
|
|
|
|
|
expect(response.response_code).to be === 404
|
2013-06-28 15:01:17 +02:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2024-07-29 16:37:43 +02:00
|
|
|
describe "with the permission to see the project " \
|
|
|
|
|
"with having the necessary permissions" do
|
2026-04-10 19:32:29 +03:00
|
|
|
let(:role) { create(:project_role, permissions: [:view_work_packages]) }
|
|
|
|
|
|
2013-08-05 18:03:40 +02:00
|
|
|
before do
|
2026-04-10 19:32:29 +03:00
|
|
|
create(:member, project: work_package.project, principal: current_user, roles: [role])
|
2013-06-28 15:01:17 +02:00
|
|
|
end
|
|
|
|
|
|
2013-08-05 18:03:40 +02:00
|
|
|
instance_eval(&)
|
2013-06-28 15:01:17 +02:00
|
|
|
end
|
|
|
|
|
end
|
2013-06-28 22:23:41 +02:00
|
|
|
|
2013-08-29 17:23:38 +02:00
|
|
|
def self.requires_export_permission(&)
|
2024-07-29 16:37:43 +02:00
|
|
|
describe "with the export permission " \
|
|
|
|
|
"without a project" do
|
2013-08-29 17:23:38 +02:00
|
|
|
let(:project) { nil }
|
2023-09-27 18:07:01 +02:00
|
|
|
let(:other_project) { build_stubbed(:project) }
|
2013-08-29 17:23:38 +02:00
|
|
|
|
|
|
|
|
before do
|
2023-09-27 18:07:01 +02:00
|
|
|
mock_permissions_for(current_user) do |mock|
|
2023-10-16 08:38:35 +02:00
|
|
|
mock.allow_in_project :export_work_packages, project: other_project
|
2023-09-27 18:07:01 +02:00
|
|
|
end
|
2013-08-29 17:23:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
instance_eval(&)
|
|
|
|
|
end
|
|
|
|
|
|
2024-07-29 16:37:43 +02:00
|
|
|
describe "with the export permission " \
|
|
|
|
|
"with a project" do
|
2013-08-29 17:23:38 +02:00
|
|
|
before do
|
|
|
|
|
params[:project_id] = project.id
|
|
|
|
|
|
2023-09-27 18:07:01 +02:00
|
|
|
mock_permissions_for(current_user) do |mock|
|
2023-10-16 08:38:35 +02:00
|
|
|
mock.allow_in_project :export_work_packages, project:
|
2023-09-27 18:07:01 +02:00
|
|
|
end
|
2013-08-29 17:23:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
instance_eval(&)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "w/o the export permission" do
|
|
|
|
|
let(:project) { nil }
|
|
|
|
|
|
|
|
|
|
before do
|
2023-10-09 10:49:02 +02:00
|
|
|
mock_permissions_for(current_user, &:forbid_everything)
|
2013-08-29 17:23:38 +02:00
|
|
|
|
|
|
|
|
call_action
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "renders a 403" do
|
2014-03-29 14:50:29 +01:00
|
|
|
expect(response.response_code).to eq(403)
|
2013-08-29 17:23:38 +02:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2013-08-29 16:33:10 +02:00
|
|
|
describe "index" do
|
2022-01-24 19:22:35 +01:00
|
|
|
let(:query) { build_stubbed(:query).tap(&:add_default_filter) }
|
2014-11-03 23:43:33 +01:00
|
|
|
let(:work_packages) { double("work packages").as_null_object }
|
2017-02-14 13:15:36 +01:00
|
|
|
let(:results) { double("results").as_null_object }
|
2013-08-29 16:33:10 +02:00
|
|
|
|
2014-02-07 11:56:51 +01:00
|
|
|
describe "with valid query" do
|
|
|
|
|
before do
|
2023-09-27 18:07:01 +02:00
|
|
|
mock_permissions_for(current_user) do |mock|
|
2023-10-16 08:38:35 +02:00
|
|
|
mock.allow_in_project :view_work_packages, project: other_project
|
2023-10-18 16:15:46 +02:00
|
|
|
mock.allow_in_project(:view_work_packages, project:) if project
|
2023-09-27 18:07:01 +02:00
|
|
|
end
|
2014-03-11 11:01:54 +01:00
|
|
|
|
2020-04-20 16:16:01 +02:00
|
|
|
allow(controller).to receive(:retrieve_query).and_return(query)
|
2014-02-07 11:56:51 +01:00
|
|
|
end
|
2013-12-16 19:00:27 +01:00
|
|
|
|
2014-02-07 11:56:51 +01:00
|
|
|
describe "html" do
|
2016-09-26 14:20:19 +02:00
|
|
|
let(:call_action) { get("index", params: { project_id: project.id }) }
|
2022-05-31 11:55:27 +02:00
|
|
|
|
2017-06-16 13:53:52 +02:00
|
|
|
before do
|
|
|
|
|
call_action
|
|
|
|
|
end
|
2013-08-28 17:10:35 +02:00
|
|
|
|
2023-09-27 18:07:01 +02:00
|
|
|
describe "without a project, but with view_work_packages permission on any project" do
|
2014-02-07 11:56:51 +01:00
|
|
|
let(:project) { nil }
|
|
|
|
|
let(:call_action) { get("index") }
|
2013-08-28 17:10:35 +02:00
|
|
|
|
2014-02-07 11:56:51 +01:00
|
|
|
it "renders the index template" do
|
2014-11-06 10:18:32 +01:00
|
|
|
expect(response).to render_template("work_packages/index")
|
2014-02-07 11:56:51 +01:00
|
|
|
end
|
2013-08-29 16:33:10 +02:00
|
|
|
end
|
2013-12-16 19:00:27 +01:00
|
|
|
|
2023-09-27 18:07:01 +02:00
|
|
|
context "with a project" do
|
2014-02-07 11:56:51 +01:00
|
|
|
it "renders the index template" do
|
2014-11-06 10:18:32 +01:00
|
|
|
expect(response).to render_template("work_packages/index")
|
2014-02-07 11:56:51 +01:00
|
|
|
end
|
2013-12-16 19:00:27 +01:00
|
|
|
end
|
|
|
|
|
end
|
2013-07-18 14:15:45 +02:00
|
|
|
|
2020-04-20 16:16:01 +02:00
|
|
|
shared_examples_for "export of mime_type" do
|
2022-01-24 19:22:35 +01:00
|
|
|
let(:export_storage) { build_stubbed(:work_packages_export) }
|
2020-04-20 16:16:01 +02:00
|
|
|
let(:call_action) { get("index", params: params.merge(format: mime_type)) }
|
2013-08-29 16:33:10 +02:00
|
|
|
|
2014-02-07 11:56:51 +01:00
|
|
|
requires_export_permission do
|
|
|
|
|
before do
|
2020-04-20 16:16:01 +02:00
|
|
|
service_instance = double("service_instance")
|
|
|
|
|
|
|
|
|
|
allow(WorkPackages::Exports::ScheduleService)
|
|
|
|
|
.to receive(:new)
|
|
|
|
|
.with(user: current_user)
|
|
|
|
|
.and_return(service_instance)
|
|
|
|
|
|
|
|
|
|
allow(service_instance)
|
|
|
|
|
.to receive(:call)
|
|
|
|
|
.with(query:, mime_type: mime_type.to_sym, params: anything)
|
2022-06-14 14:41:07 +02:00
|
|
|
.and_return(ServiceResult.failure(result: "uuid of the export job"))
|
2014-01-09 16:50:34 +01:00
|
|
|
end
|
2013-08-29 14:18:44 +02:00
|
|
|
|
2020-06-17 16:40:52 +02:00
|
|
|
it "redirects to the job status" do
|
2014-02-07 11:56:51 +01:00
|
|
|
call_action
|
2020-06-17 16:40:52 +02:00
|
|
|
expect(response).to redirect_to job_status_path("uuid of the export job")
|
|
|
|
|
end
|
2020-04-20 16:16:01 +02:00
|
|
|
|
2020-06-17 16:40:52 +02:00
|
|
|
context "with json accept" do
|
|
|
|
|
it "fulfills the defined should_receives" do
|
|
|
|
|
request.headers["Accept"] = "application/json"
|
|
|
|
|
call_action
|
|
|
|
|
expect(response.body).to eq({ job_id: "uuid of the export job" }.to_json)
|
|
|
|
|
end
|
2014-02-07 11:56:51 +01:00
|
|
|
end
|
2013-08-29 16:33:10 +02:00
|
|
|
end
|
2013-08-29 14:18:44 +02:00
|
|
|
end
|
|
|
|
|
|
2020-04-20 16:16:01 +02:00
|
|
|
describe "csv" do
|
2014-02-07 11:56:51 +01:00
|
|
|
let(:params) { {} }
|
2020-04-20 16:16:01 +02:00
|
|
|
let(:mime_type) { "csv" }
|
2016-08-24 16:49:42 +02:00
|
|
|
|
2020-04-20 16:16:01 +02:00
|
|
|
it_behaves_like "export of mime_type"
|
|
|
|
|
end
|
2017-06-16 13:53:52 +02:00
|
|
|
|
2020-04-20 16:16:01 +02:00
|
|
|
describe "pdf" do
|
|
|
|
|
let(:params) { {} }
|
|
|
|
|
let(:mime_type) { "pdf" }
|
2017-06-16 13:53:52 +02:00
|
|
|
|
2021-11-02 08:34:08 +01:00
|
|
|
it_behaves_like "export of mime_type"
|
2014-02-07 11:56:51 +01:00
|
|
|
end
|
2013-08-29 15:57:54 +02:00
|
|
|
|
2014-02-07 11:56:51 +01:00
|
|
|
describe "atom" do
|
|
|
|
|
let(:params) { {} }
|
2016-09-14 13:45:31 +02:00
|
|
|
let(:call_action) { get("index", params: params.merge(format: "atom")) }
|
2014-02-07 11:56:51 +01:00
|
|
|
|
|
|
|
|
requires_export_permission do
|
|
|
|
|
before do
|
2020-04-20 16:16:01 +02:00
|
|
|
# Note: Stubs for methods used to build up the json query results.
|
|
|
|
|
# TODO RS: Clearly this isn't testing anything, but it all needs to be moved to an API controller anyway.
|
|
|
|
|
allow(query).to receive(:results).and_return(results)
|
2020-09-10 11:37:50 +02:00
|
|
|
allow(results).to receive_message_chain(:work_packages, :page, :per_page).and_return(work_packages)
|
2020-04-20 16:16:01 +02:00
|
|
|
|
2014-11-03 23:43:33 +01:00
|
|
|
expect(controller).to receive(:render_feed).with(work_packages, anything) do |*_args|
|
2014-02-07 11:56:51 +01:00
|
|
|
# We need to render something because otherwise
|
2020-04-20 16:16:01 +02:00
|
|
|
# the controller will and it will not find a suitable template
|
2016-09-14 13:45:31 +02:00
|
|
|
controller.render plain: "success"
|
2014-02-07 11:56:51 +01:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "fulfills the defined should_receives" do
|
|
|
|
|
call_action
|
|
|
|
|
end
|
2013-08-29 16:33:10 +02:00
|
|
|
end
|
|
|
|
|
end
|
2013-08-29 15:57:54 +02:00
|
|
|
end
|
|
|
|
|
|
2020-04-20 16:16:01 +02:00
|
|
|
context "with invalid query" do
|
|
|
|
|
describe "pdf" do
|
|
|
|
|
let(:call_action) { get("index", params: params.merge(format: "pdf")) }
|
|
|
|
|
let(:params) { { query_id: "hokusbogus" } }
|
2014-02-06 13:08:17 +00:00
|
|
|
|
2021-07-21 11:26:31 -04:00
|
|
|
context "when a non-existent query has been previously selected" do
|
2020-04-20 16:16:01 +02:00
|
|
|
before do
|
2023-10-09 10:49:02 +02:00
|
|
|
mock_permissions_for(current_user, &:allow_everything)
|
2014-02-06 13:08:17 +00:00
|
|
|
|
2020-04-20 16:16:01 +02:00
|
|
|
allow(controller)
|
|
|
|
|
.to receive(:retrieve_query)
|
|
|
|
|
.and_raise(ActiveRecord::RecordNotFound)
|
2014-02-06 13:08:17 +00:00
|
|
|
|
2020-04-20 16:16:01 +02:00
|
|
|
call_action
|
|
|
|
|
end
|
2014-02-06 13:08:17 +00:00
|
|
|
|
2020-04-20 16:16:01 +02:00
|
|
|
it "renders a 404" do
|
|
|
|
|
expect(response.response_code).to be 404
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2014-02-06 13:08:17 +00:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2013-11-28 16:17:01 +01:00
|
|
|
describe "index with a broken project reference" do
|
2016-09-14 13:45:31 +02:00
|
|
|
before do
|
|
|
|
|
get("index", params: { project_id: "project_that_doesnt_exist" })
|
|
|
|
|
end
|
2013-11-28 16:17:01 +01:00
|
|
|
|
2014-04-17 23:35:32 +02:00
|
|
|
it { is_expected.to respond_with :not_found }
|
2013-11-28 16:17:01 +01:00
|
|
|
end
|
|
|
|
|
|
2013-08-05 18:03:40 +02:00
|
|
|
describe "show.html" do
|
2026-04-10 19:32:29 +03:00
|
|
|
let(:call_action) { get("show", params: { id: work_package.id.to_s }) }
|
2013-07-18 14:15:45 +02:00
|
|
|
|
2013-08-05 18:03:40 +02:00
|
|
|
requires_permission_in_project do
|
2025-11-03 09:02:16 +01:00
|
|
|
it "redirects to the full url" do
|
2013-08-05 18:03:40 +02:00
|
|
|
call_action
|
2013-07-18 14:15:45 +02:00
|
|
|
|
2026-04-10 19:32:29 +03:00
|
|
|
expect(response).to redirect_to("/projects/test_project/work_packages/#{work_package.id}/activity")
|
2013-07-18 14:15:45 +02:00
|
|
|
end
|
|
|
|
|
end
|
2013-08-05 18:03:40 +02:00
|
|
|
end
|
2013-07-18 14:15:45 +02:00
|
|
|
|
2026-04-15 15:32:40 +03:00
|
|
|
describe "show.html with semantic identifier",
|
|
|
|
|
with_settings: { work_packages_identifier: "semantic" } do
|
|
|
|
|
let(:project) { create(:project, identifier: "TESTPROJ") }
|
|
|
|
|
let(:call_action) { get("show", params: { id: work_package.display_id.to_s }) }
|
|
|
|
|
|
|
|
|
|
requires_permission_in_project do
|
|
|
|
|
it "resolves the semantic identifier and redirects to the full url" do
|
|
|
|
|
call_action
|
|
|
|
|
|
|
|
|
|
expect(response).to redirect_to("/projects/TESTPROJ/work_packages/#{work_package.display_id}/activity")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2013-08-05 18:03:40 +02:00
|
|
|
describe "show.pdf" do
|
2026-04-10 19:32:29 +03:00
|
|
|
let(:call_action) { get("show", params: { format: "pdf", id: work_package.id.to_s }) }
|
2021-11-02 08:34:08 +01:00
|
|
|
let(:exporter) { WorkPackage::PDFExport::WorkPackageToPdf }
|
|
|
|
|
let(:exporter_instance) { instance_double(exporter) }
|
|
|
|
|
|
|
|
|
|
before do
|
|
|
|
|
allow(exporter).to receive(:new).and_return(exporter_instance)
|
|
|
|
|
end
|
2013-07-18 14:15:45 +02:00
|
|
|
|
2013-08-05 18:03:40 +02:00
|
|
|
requires_permission_in_project do
|
|
|
|
|
it "respond with a pdf" do
|
2016-05-06 09:53:38 +01:00
|
|
|
pdf_data = "foobar"
|
2023-07-03 12:58:34 +02:00
|
|
|
time = DateTime.new(2023, 6, 30, 23, 59)
|
|
|
|
|
allow(DateTime).to receive(:now).and_return(time)
|
2026-04-10 19:32:29 +03:00
|
|
|
expected_name = [work_package.project.identifier, "##{work_package.id}",
|
|
|
|
|
work_package.subject, "2023-06-30_23-59"].join("_").tr(" ", "-")
|
2017-06-16 13:53:52 +02:00
|
|
|
expected_type = "application/pdf"
|
|
|
|
|
pdf_result = double("pdf_result",
|
|
|
|
|
error?: false,
|
|
|
|
|
content: pdf_data,
|
|
|
|
|
title: expected_name,
|
|
|
|
|
mime_type: expected_type)
|
|
|
|
|
|
2021-11-02 08:58:06 +01:00
|
|
|
allow(exporter_instance).to receive(:export!).and_return(pdf_result)
|
2016-05-06 09:53:38 +01:00
|
|
|
expect(controller).to receive(:send_data).with(pdf_data,
|
2017-06-16 13:53:52 +02:00
|
|
|
type: expected_type,
|
2014-11-03 23:43:33 +01:00
|
|
|
filename: expected_name) do |*_args|
|
2014-01-09 16:50:34 +01:00
|
|
|
# We need to render something because otherwise
|
2020-04-20 16:16:01 +02:00
|
|
|
# the controller will and it will not find a suitable template
|
2016-09-14 13:45:31 +02:00
|
|
|
controller.render plain: "success"
|
2014-01-09 16:50:34 +01:00
|
|
|
end
|
2013-08-05 18:03:40 +02:00
|
|
|
call_action
|
2013-07-18 14:15:45 +02:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2013-09-02 11:54:32 +02:00
|
|
|
describe "show.atom" do
|
2026-04-10 19:32:29 +03:00
|
|
|
let(:call_action) { get("show", params: { format: "atom", id: work_package.id.to_s }) }
|
2013-09-02 11:54:32 +02:00
|
|
|
|
|
|
|
|
requires_permission_in_project do
|
|
|
|
|
it "render the journal/index template" do
|
|
|
|
|
call_action
|
2014-11-06 10:18:32 +01:00
|
|
|
expect(response).to render_template("journals/index")
|
2013-09-02 11:54:32 +02:00
|
|
|
end
|
|
|
|
|
end
|
2025-04-11 12:15:44 +02:00
|
|
|
|
2025-04-28 17:13:25 +02:00
|
|
|
context "when there are internal comments" do
|
2025-04-11 12:15:44 +02:00
|
|
|
render_views
|
|
|
|
|
|
|
|
|
|
let(:admin) { create(:admin) }
|
|
|
|
|
let(:project) do
|
2025-04-22 12:13:44 +02:00
|
|
|
create(:project, identifier: "test_project", public: false, enabled_internal_comments: true)
|
2025-04-11 12:15:44 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
before do
|
|
|
|
|
work_package = create(:work_package, id: 5173, project:)
|
|
|
|
|
create(:work_package_journal,
|
|
|
|
|
journable: work_package,
|
|
|
|
|
user: admin,
|
|
|
|
|
notes: "internal comment",
|
2025-04-22 12:13:44 +02:00
|
|
|
internal: true,
|
2025-04-11 12:15:44 +02:00
|
|
|
version: 2)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context "and the user does not have permission to see such comments" do
|
|
|
|
|
it "does not include internal comments" do
|
|
|
|
|
get("show", params: { format: "atom", id: 5173 })
|
|
|
|
|
expect(response.body).not_to include("internal comment")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2026-01-28 21:10:53 +03:00
|
|
|
context "and the user has permission to see such comments", with_ee: [:internal_comments] do
|
2025-04-11 12:15:44 +02:00
|
|
|
before do
|
|
|
|
|
login_as admin
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "includes internal comments" do
|
|
|
|
|
get("show", params: { format: "atom", id: 5173 })
|
|
|
|
|
expect(response.body).to include("internal comment")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2013-09-02 11:54:32 +02:00
|
|
|
end
|
2016-11-25 09:32:39 +01:00
|
|
|
|
|
|
|
|
describe "redirect deep link", with_settings: { login_required?: true } do
|
|
|
|
|
let(:current_user) { User.anonymous }
|
2017-05-15 11:58:14 +02:00
|
|
|
let(:params) do
|
2016-11-25 09:32:39 +01:00
|
|
|
{ project_id: project.id }
|
2017-05-15 11:58:14 +02:00
|
|
|
end
|
2016-11-25 09:32:39 +01:00
|
|
|
|
2017-05-15 11:58:14 +02:00
|
|
|
it "redirects to collection with query" do
|
|
|
|
|
get "index", params: params.merge(query_id: 123, query_props: "foo")
|
|
|
|
|
expect(response).to be_redirect
|
2016-11-25 09:32:39 +01:00
|
|
|
|
2017-05-15 11:58:14 +02:00
|
|
|
location = "/projects/#{project.id}/work_packages?query_id=123&query_props=foo"
|
|
|
|
|
expect(response.location).to end_with(CGI.escape(location))
|
|
|
|
|
end
|
2016-11-25 09:32:39 +01:00
|
|
|
end
|
2013-06-28 15:01:17 +02:00
|
|
|
end
|