Welcome to mirror list, hosted at ThFree Co, Russian Federation.

draw_route_spec.rb « patch « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d983f6f15bb85cc8f107a5f3e4b42fcda90ea712 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

require 'fast_spec_helper'

RSpec.describe Gitlab::Patch::DrawRoute do
  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)

    route_file_path = subject.route_path('config/routes/help.rb')

    expect(subject).to have_received(:instance_eval)
      .with(File.read(route_file_path), route_file_path)
      .once

    expect(subject).to have_received(:instance_eval)
      .once
  end
end