diff options
Diffstat (limited to 'spec/features/projects/branches_spec.rb')
-rw-r--r-- | spec/features/projects/branches_spec.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index 7668ce5f8be..8694366de35 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' describe 'Branches', feature: true do + let(:user) { create(:user) } let(:project) { create(:project, :public) } let(:repository) { project.repository } @@ -12,8 +13,8 @@ describe 'Branches', feature: true do context 'logged in as developer' do before do - login_as :user - project.team << [@user, :developer] + sign_in(user) + project.team << [user, :developer] end describe 'Initial branches page' do @@ -27,7 +28,7 @@ describe 'Branches', feature: true do it 'avoids a N+1 query in branches index' do control_count = ActiveRecord::QueryRecorder.new { visit namespace_project_branches_path(project.namespace, project) }.count - %w(one two three four five).each { |ref| repository.add_branch(@user, ref, 'master') } + %w(one two three four five).each { |ref| repository.add_branch(user, ref, 'master') } expect { visit namespace_project_branches_path(project.namespace, project) }.not_to exceed_query_limit(control_count) end @@ -64,14 +65,14 @@ describe 'Branches', feature: true do describe 'Delete protected branch' do before do - project.add_user(@user, :master) + project.add_user(user, :master) visit namespace_project_protected_branches_path(project.namespace, project) set_protected_branch_name('fix') click_on "Protect" within(".protected-branches-list") { expect(page).to have_content('fix') } expect(ProtectedBranch.count).to eq(1) - project.add_user(@user, :developer) + project.add_user(user, :developer) end it 'does not allow devleoper to removes protected branch', js: true do @@ -87,8 +88,8 @@ describe 'Branches', feature: true do context 'logged in as master' do before do - login_as :user - project.team << [@user, :master] + sign_in(user) + project.team << [user, :master] end describe 'Delete protected branch' do |