Commit 4d6dadc8 authored by Timothy Andrew's avatar Timothy Andrew

Make specs compatible with PhantomJS versions < 2.

1. These versions of PhantomJS don't support `PATCH` requests, so we use
   a `POST` with `_method` set to `PATCH`.
parent f2df2966
...@@ -21,10 +21,11 @@ class @ProtectedBranchesAccessSelect ...@@ -21,10 +21,11 @@ class @ProtectedBranchesAccessSelect
$(dropdown).find('.dropdown-toggle-text').text(selected.text) $(dropdown).find('.dropdown-toggle-text').text(selected.text)
if @saveOnSelect if @saveOnSelect
$.ajax $.ajax
type: "PATCH" type: "POST"
url: $(dropdown).data('url') url: $(dropdown).data('url')
dataType: "json" dataType: "json"
data: data:
_method: 'PATCH'
id: $(dropdown).data('id') id: $(dropdown).data('id')
protected_branch: protected_branch:
"#{$(dropdown).data('type')}": selected.id "#{$(dropdown).data('type')}": selected.id
......
...@@ -97,8 +97,6 @@ feature 'Projected Branches', feature: true, js: true do ...@@ -97,8 +97,6 @@ feature 'Projected Branches', feature: true, js: true do
expect(ProtectedBranch.last.allowed_to_push).to eq(access_type_id) expect(ProtectedBranch.last.allowed_to_push).to eq(access_type_id)
end end
# This spec fails on PhantomJS versions below 2.0, which don't support `PATCH` requests.
# https://github.com/ariya/phantomjs/issues/11384
it "allows updating protected branches so that #{access_type_name} can push to them" do it "allows updating protected branches so that #{access_type_name} can push to them" do
visit namespace_project_protected_branches_path(project.namespace, project) visit namespace_project_protected_branches_path(project.namespace, project)
set_protected_branch_name('master') set_protected_branch_name('master')
...@@ -130,8 +128,6 @@ feature 'Projected Branches', feature: true, js: true do ...@@ -130,8 +128,6 @@ feature 'Projected Branches', feature: true, js: true do
expect(ProtectedBranch.last.allowed_to_merge).to eq(access_type_id) expect(ProtectedBranch.last.allowed_to_merge).to eq(access_type_id)
end end
# This spec fails on PhantomJS versions below 2.0, which don't support `PATCH` requests.
# https://github.com/ariya/phantomjs/issues/11384
it "allows updating protected branches so that #{access_type_name} can merge to them" do it "allows updating protected branches so that #{access_type_name} can merge to them" do
visit namespace_project_protected_branches_path(project.namespace, project) visit namespace_project_protected_branches_path(project.namespace, project)
set_protected_branch_name('master') set_protected_branch_name('master')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment