Make it possible to mix `Gitlab::Routing` in
This commit is contained in:
parent
00970606d7
commit
84290a452d
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue