Commit 84290a45 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Make it possible to mix `Gitlab::Routing` in

parent 00970606
...@@ -4,7 +4,7 @@ module Gitlab ...@@ -4,7 +4,7 @@ module Gitlab
# Base abstract class fore core status # Base abstract class fore core status
# #
class Core class Core
include Gitlab::Routing.url_helpers include Gitlab::Routing
include Gitlab::Allowable include Gitlab::Allowable
attr_reader :subject, :user attr_reader :subject, :user
......
module Gitlab module Gitlab
module Routing module Routing
extend ActiveSupport::Concern
included do
include Gitlab::Routing.url_helpers
end
# Returns the URL helpers Module. # Returns the URL helpers Module.
# #
# This method caches the output as Rails' "url_helpers" method creates an # This method caches the output as Rails' "url_helpers" method creates an
......
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment