2018-12-13 13:39:08 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'fast_spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::Patch::DrawRoute do
|
2018-12-13 13:39:08 +05:30
|
|
|
subject do
|
|
|
|
Class.new do
|
|
|
|
include Gitlab::Patch::DrawRoute
|
|
|
|
|
|
|
|
def route_path(route_name)
|
|
|
|
File.expand_path("../../../../#{route_name}", __dir__)
|
|
|
|
end
|
|
|
|
end.new
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(subject).to receive(:instance_eval)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'evaluates CE only route' do
|
|
|
|
subject.draw(:help)
|
|
|
|
|
2023-07-09 08:55:56 +05:30
|
|
|
route_file_path = subject.route_path('config/routes/help.rb')
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
expect(subject).to have_received(:instance_eval)
|
2023-07-09 08:55:56 +05:30
|
|
|
.with(File.read(route_file_path), route_file_path)
|
2018-12-13 13:39:08 +05:30
|
|
|
.once
|
|
|
|
|
|
|
|
expect(subject).to have_received(:instance_eval)
|
|
|
|
.once
|
|
|
|
end
|
|
|
|
end
|