diff --git a/lib/gitlab/ci/status/core.rb b/lib/gitlab/ci/status/core.rb index 12c0ca1d6d5349caf63bb68dc60b25131b62027f..46fef8262c19b3819b8b81158388b9493e7e8f72 100644 --- a/lib/gitlab/ci/status/core.rb +++ b/lib/gitlab/ci/status/core.rb @@ -4,7 +4,7 @@ module Gitlab # Base abstract class fore core status # class Core - include Gitlab::Routing.url_helpers + include Gitlab::Routing include Gitlab::Allowable attr_reader :subject, :user diff --git a/lib/gitlab/routing.rb b/lib/gitlab/routing.rb index 5132177de516ee6b9eab38a57adfd87e161169b3..632e2d875000c9fccb8284d49edadd4d8bdbbb2f 100644 --- a/lib/gitlab/routing.rb +++ b/lib/gitlab/routing.rb @@ -1,5 +1,11 @@ module Gitlab module Routing + extend ActiveSupport::Concern + + included do + include Gitlab::Routing.url_helpers + end + # Returns the URL helpers Module. # # This method caches the output as Rails' "url_helpers" method creates an diff --git a/spec/lib/gitlab/routing_spec.rb b/spec/lib/gitlab/routing_spec.rb new file mode 100644 index 0000000000000000000000000000000000000000..01d5acfc15b7ef244be147ba51fab4bfc92e2045 --- /dev/null +++ b/spec/lib/gitlab/routing_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe Gitlab::Routing do + context 'when module is included' do + subject do + Class.new.include(described_class).new + end + + it 'makes it possible to access url helpers' do + expect(subject).to respond_to(:namespace_project_path) + end + end + + context 'when module is not included' do + subject do + Class.new.include(described_class.url_helpers).new + end + + it 'exposes url helpers module through a method' do + expect(subject).to respond_to(:namespace_project_path) + end + end +end