gitlab-org--gitlab-foss/spec/lib/gitlab/rack_attack/request_spec.rb

16 lines
721 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::RackAttack::Request do
describe 'FILES_PATH_REGEX' do
subject { described_class::FILES_PATH_REGEX }
it { is_expected.to match('/api/v4/projects/1/repository/files/README') }
it { is_expected.to match('/api/v4/projects/1/repository/files/README?ref=master') }
it { is_expected.to match('/api/v4/projects/1/repository/files/README/blame') }
it { is_expected.to match('/api/v4/projects/1/repository/files/README/raw') }
it { is_expected.to match('/api/v4/projects/some%2Fnested%2Frepo/repository/files/README') }
it { is_expected.not_to match('/api/v4/projects/some/nested/repo/repository/files/README') }
end
end