summaryrefslogtreecommitdiff
path: root/spec/features/protected_branches_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/protected_branches_spec.rb')
-rw-r--r--spec/features/protected_branches_spec.rb90
1 files changed, 45 insertions, 45 deletions
diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb
index 0aff916ec83..8e9ca595402 100644
--- a/spec/features/protected_branches_spec.rb
+++ b/spec/features/protected_branches_spec.rb
@@ -1,68 +1,68 @@
-require 'spec_helper'
+require "spec_helper"
-describe 'Protected Branches', :js do
+describe "Protected Branches", :js do
let(:user) { create(:user) }
let(:admin) { create(:admin) }
let(:project) { create(:project, :repository) }
- context 'logged in as developer' do
+ context "logged in as developer" do
before do
project.add_developer(user)
sign_in(user)
end
- describe 'Delete protected branch' do
+ describe "Delete protected branch" do
before do
- create(:protected_branch, project: project, name: 'fix')
+ create(:protected_branch, project: project, name: "fix")
expect(ProtectedBranch.count).to eq(1)
end
- it 'does not allow developer to removes protected branch' do
+ it "does not allow developer to removes protected branch" do
visit project_branches_path(project)
- fill_in 'branch-search', with: 'fix'
- find('#branch-search').native.send_keys(:enter)
+ fill_in "branch-search", with: "fix"
+ find("#branch-search").native.send_keys(:enter)
- expect(page).to have_css('.btn-remove.disabled')
+ expect(page).to have_css(".btn-remove.disabled")
end
end
end
- context 'logged in as maintainer' do
+ context "logged in as maintainer" do
before do
project.add_maintainer(user)
sign_in(user)
end
- describe 'Delete protected branch' do
+ describe "Delete protected branch" do
before do
- create(:protected_branch, project: project, name: 'fix')
+ create(:protected_branch, project: project, name: "fix")
expect(ProtectedBranch.count).to eq(1)
end
- it 'removes branch after modal confirmation' do
+ it "removes branch after modal confirmation" do
visit project_branches_path(project)
- fill_in 'branch-search', with: 'fix'
- find('#branch-search').native.send_keys(:enter)
+ fill_in "branch-search", with: "fix"
+ find("#branch-search").native.send_keys(:enter)
- expect(page).to have_content('fix')
- expect(find('.all-branches')).to have_selector('li', count: 1)
+ expect(page).to have_content("fix")
+ expect(find(".all-branches")).to have_selector("li", count: 1)
page.find('[data-target="#modal-delete-branch"]').click
- expect(page).to have_css('.js-delete-branch[disabled]')
- fill_in 'delete_branch_input', with: 'fix'
- click_link 'Delete protected branch'
+ expect(page).to have_css(".js-delete-branch[disabled]")
+ fill_in "delete_branch_input", with: "fix"
+ click_link "Delete protected branch"
- fill_in 'branch-search', with: 'fix'
- find('#branch-search').native.send_keys(:enter)
+ fill_in "branch-search", with: "fix"
+ find("#branch-search").native.send_keys(:enter)
- expect(page).to have_content('No branches to show')
+ expect(page).to have_content("No branches to show")
end
end
end
- context 'logged in as admin' do
+ context "logged in as admin" do
before do
sign_in(admin)
end
@@ -71,21 +71,21 @@ describe 'Protected Branches', :js do
it "allows creating explicit protected branches" do
visit project_protected_branches_path(project)
set_defaults
- set_protected_branch_name('some-branch')
+ set_protected_branch_name("some-branch")
click_on "Protect"
- within(".protected-branches-list") { expect(page).to have_content('some-branch') }
+ within(".protected-branches-list") { expect(page).to have_content("some-branch") }
expect(ProtectedBranch.count).to eq(1)
- expect(ProtectedBranch.last.name).to eq('some-branch')
+ expect(ProtectedBranch.last.name).to eq("some-branch")
end
it "displays the last commit on the matching branch if it exists" do
commit = create(:commit, project: project)
- project.repository.add_branch(admin, 'some-branch', commit.id)
+ project.repository.add_branch(admin, "some-branch", commit.id)
visit project_protected_branches_path(project)
set_defaults
- set_protected_branch_name('some-branch')
+ set_protected_branch_name("some-branch")
click_on "Protect"
within(".protected-branches-list") { expect(page).to have_content(commit.id[0..7]) }
@@ -94,10 +94,10 @@ describe 'Protected Branches', :js do
it "displays an error message if the named branch does not exist" do
visit project_protected_branches_path(project)
set_defaults
- set_protected_branch_name('some-branch')
+ set_protected_branch_name("some-branch")
click_on "Protect"
- within(".protected-branches-list") { expect(page).to have_content('branch was deleted') }
+ within(".protected-branches-list") { expect(page).to have_content("branch was deleted") }
end
end
@@ -105,21 +105,21 @@ describe 'Protected Branches', :js do
it "allows creating protected branches with a wildcard" do
visit project_protected_branches_path(project)
set_defaults
- set_protected_branch_name('*-stable')
+ set_protected_branch_name("*-stable")
click_on "Protect"
- within(".protected-branches-list") { expect(page).to have_content('*-stable') }
+ within(".protected-branches-list") { expect(page).to have_content("*-stable") }
expect(ProtectedBranch.count).to eq(1)
- expect(ProtectedBranch.last.name).to eq('*-stable')
+ expect(ProtectedBranch.last.name).to eq("*-stable")
end
it "displays the number of matching branches" do
- project.repository.add_branch(admin, 'production-stable', 'master')
- project.repository.add_branch(admin, 'staging-stable', 'master')
+ project.repository.add_branch(admin, "production-stable", "master")
+ project.repository.add_branch(admin, "staging-stable", "master")
visit project_protected_branches_path(project)
set_defaults
- set_protected_branch_name('*-stable')
+ set_protected_branch_name("*-stable")
click_on "Protect"
within(".protected-branches-list") do
@@ -129,12 +129,12 @@ describe 'Protected Branches', :js do
end
it "displays all the branches matching the wildcard" do
- project.repository.add_branch(admin, 'production-stable', 'master')
- project.repository.add_branch(admin, 'staging-stable', 'master')
- project.repository.add_branch(admin, 'development', 'master')
+ project.repository.add_branch(admin, "production-stable", "master")
+ project.repository.add_branch(admin, "staging-stable", "master")
+ project.repository.add_branch(admin, "development", "master")
visit project_protected_branches_path(project)
- set_protected_branch_name('*-stable')
+ set_protected_branch_name("*-stable")
set_defaults
click_on "Protect"
@@ -162,15 +162,15 @@ describe 'Protected Branches', :js do
def set_defaults
find(".js-allowed-to-merge").click
- within('.qa-allowed-to-merge-dropdown') do
+ within(".qa-allowed-to-merge-dropdown") do
expect(first("li")).to have_content("Roles")
- find(:link, 'No one').click
+ find(:link, "No one").click
end
find(".js-allowed-to-push").click
- within('.qa-allowed-to-push-dropdown') do
+ within(".qa-allowed-to-push-dropdown") do
expect(first("li")).to have_content("Roles")
- find(:link, 'No one').click
+ find(:link, "No one").click
end
end
end