Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

restore using url_helpers directly in custom field journal formatter spec

Ivan Kuchin401393d71c0a
diff --git a/spec/lib/open_project/journal_formatter/custom_field_spec.rb b/spec/lib/open_project/journal_formatter/custom_field_spec.rb
index f541764b41e..e5c7869c94a 100644
--- a/spec/lib/open_project/journal_formatter/custom_field_spec.rb
+++ b/spec/lib/open_project/journal_formatter/custom_field_spec.rb
@@ -33,12 +33,11 @@ require "spec_helper"
RSpec.describe OpenProject::JournalFormatter::CustomField do
include CustomFieldsHelper
include ActionView::Helpers::TagHelper
- # WARNING: the order of the modules is important to ensure that url_for of
+ # WARNING: the order of inclusion is important to ensure that url_for of
# ActionController::UrlWriter is called and not the one of ActionView::Helpers::UrlHelper
+ include Rails.application.routes.url_helpers
include ActionView::Helpers::UrlHelper
- def url_helper = Rails.application.routes.url_helpers
-
let(:instance) { described_class.new(journal) }
let(:id) { 1 }
let(:journal) { instance_double(Journal, id:) }
@@ -335,14 +334,14 @@ RSpec.describe OpenProject::JournalFormatter::CustomField do
let(:custom_field) { build_stubbed(:text_wp_custom_field) }
let(:path) do
- url_helper.diff_journal_path(id: journal.id,
- field: key.downcase)
+ diff_journal_path(id: journal.id,
+ field: key.downcase)
end
let(:url) do
- url_helper.diff_journal_url(id: journal.id,
- field: key.downcase,
- protocol: Setting.protocol,
- host: Setting.host_name)
+ diff_journal_url(id: journal.id,
+ field: key.downcase,
+ protocol: Setting.protocol,
+ host: Setting.host_name)
end
let(:link) { link_to(I18n.t(:label_details), path, class: "diff-details", target: "_top") }
let(:full_url_link) { link_to(I18n.t(:label_details), url, class: "diff-details", target: "_top") }