diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-07 18:06:21 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-07 18:06:21 +0000 |
commit | d8ccc7a00b7a1ea954263170a2044257424a2cfe (patch) | |
tree | 0a29cb558aae61795da47c82ce7e87983c5dc4af /spec/lib/constraints | |
parent | 90a06a20be61bb6d48d77746091492831153e075 (diff) | |
download | gitlab-ce-d8ccc7a00b7a1ea954263170a2044257424a2cfe.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/constraints')
-rw-r--r-- | spec/lib/constraints/project_url_constrainer_spec.rb | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/spec/lib/constraints/project_url_constrainer_spec.rb b/spec/lib/constraints/project_url_constrainer_spec.rb index ac3221ecab7..27d70d562c1 100644 --- a/spec/lib/constraints/project_url_constrainer_spec.rb +++ b/spec/lib/constraints/project_url_constrainer_spec.rb @@ -14,42 +14,15 @@ describe Constraints::ProjectUrlConstrainer do end context 'invalid request' do - context "non-existing project" do - let(:request) { build_request('foo', 'bar') } - - it { expect(subject.matches?(request)).to be_falsey } - - context 'existence_check is false' do - it { expect(subject.matches?(request, existence_check: false)).to be_truthy } - end - end - context "project id ending with .git" do let(:request) { build_request(namespace.full_path, project.path + '.git') } it { expect(subject.matches?(request)).to be_falsey } end end - - context 'when the request matches a redirect route' do - let(:old_project_path) { 'old_project_path' } - let!(:redirect_route) { project.redirect_routes.create!(path: "#{namespace.full_path}/#{old_project_path}") } - - context 'and is a GET request' do - let(:request) { build_request(namespace.full_path, old_project_path) } - it { expect(subject.matches?(request)).to be_truthy } - end - - context 'and is NOT a GET request' do - let(:request) { build_request(namespace.full_path, old_project_path, 'POST') } - it { expect(subject.matches?(request)).to be_falsey } - end - end end - def build_request(namespace, project, method = 'GET') - double(:request, - 'get?': (method == 'GET'), - params: { namespace_id: namespace, id: project }) + def build_request(namespace, project) + double(:request, params: { namespace_id: namespace, id: project }) end end |