2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Gitlab::EtagCaching::Router do
|
|
|
|
it 'matches issue notes endpoint' do
|
2017-09-10 17:25:29 +05:30
|
|
|
result = described_class.match(
|
2017-08-17 22:00:37 +05:30
|
|
|
'/my-group/and-subgroup/here-comes-the-project/noteable/issue/1/notes'
|
|
|
|
)
|
|
|
|
|
|
|
|
expect(result).to be_present
|
|
|
|
expect(result.name).to eq 'issue_notes'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'matches issue title endpoint' do
|
2017-09-10 17:25:29 +05:30
|
|
|
result = described_class.match(
|
|
|
|
'/my-group/my-project/issues/123/realtime_changes'
|
2017-08-17 22:00:37 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
expect(result).to be_present
|
|
|
|
expect(result.name).to eq 'issue_title'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'matches project pipelines endpoint' do
|
2017-09-10 17:25:29 +05:30
|
|
|
result = described_class.match(
|
2017-08-17 22:00:37 +05:30
|
|
|
'/my-group/my-project/pipelines.json'
|
|
|
|
)
|
|
|
|
|
|
|
|
expect(result).to be_present
|
|
|
|
expect(result.name).to eq 'project_pipelines'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'matches commit pipelines endpoint' do
|
2017-09-10 17:25:29 +05:30
|
|
|
result = described_class.match(
|
2017-08-17 22:00:37 +05:30
|
|
|
'/my-group/my-project/commit/aa8260d253a53f73f6c26c734c72fdd600f6e6d4/pipelines.json'
|
|
|
|
)
|
|
|
|
|
|
|
|
expect(result).to be_present
|
|
|
|
expect(result.name).to eq 'commit_pipelines'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'matches new merge request pipelines endpoint' do
|
2017-09-10 17:25:29 +05:30
|
|
|
result = described_class.match(
|
2017-08-17 22:00:37 +05:30
|
|
|
'/my-group/my-project/merge_requests/new.json'
|
|
|
|
)
|
|
|
|
|
|
|
|
expect(result).to be_present
|
|
|
|
expect(result.name).to eq 'new_merge_request_pipelines'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'matches merge request pipelines endpoint' do
|
2017-09-10 17:25:29 +05:30
|
|
|
result = described_class.match(
|
2017-08-17 22:00:37 +05:30
|
|
|
'/my-group/my-project/merge_requests/234/pipelines.json'
|
|
|
|
)
|
|
|
|
|
|
|
|
expect(result).to be_present
|
|
|
|
expect(result.name).to eq 'merge_request_pipelines'
|
|
|
|
end
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
it 'matches build endpoint' do
|
|
|
|
result = described_class.match(
|
|
|
|
'/my-group/my-project/builds/234.json'
|
|
|
|
)
|
|
|
|
|
|
|
|
expect(result).to be_present
|
|
|
|
expect(result.name).to eq 'project_build'
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it 'does not match blob with confusing name' do
|
2017-09-10 17:25:29 +05:30
|
|
|
result = described_class.match(
|
2017-08-17 22:00:37 +05:30
|
|
|
'/my-group/my-project/blob/master/pipelines.json'
|
|
|
|
)
|
|
|
|
|
|
|
|
expect(result).to be_blank
|
|
|
|
end
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
it 'matches the environments path' do
|
|
|
|
result = described_class.match(
|
|
|
|
'/my-group/my-project/environments.json'
|
|
|
|
)
|
|
|
|
|
|
|
|
expect(result).to be_present
|
|
|
|
expect(result.name).to eq 'environments'
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it 'matches pipeline#show endpoint' do
|
2017-09-10 17:25:29 +05:30
|
|
|
result = described_class.match(
|
2017-08-17 22:00:37 +05:30
|
|
|
'/my-group/my-project/pipelines/2.json'
|
|
|
|
)
|
|
|
|
|
|
|
|
expect(result).to be_present
|
|
|
|
expect(result.name).to eq 'project_pipeline'
|
|
|
|
end
|
|
|
|
end
|