Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2017-06-20 05:06:13 +0300
committerRobert Speicher <rspeicher@gmail.com>2017-06-20 05:06:13 +0300
commit2dac8f444cd5106d43f77c4946f64c3baccae13b (patch)
tree77a6ad9463c197d0a8033d9d0a6b07b1e4e6d3de /spec/features/projects/branches_spec.rb
parent1c64fa08aeab7e56a4bef7da24840b12eb03b9ac (diff)
Remove implicit dependency on `gitlab_sign_in` assigning `@user`
We shouldn't be using instance variables in specs to begin with, and depending on this implicit behavior of `gitlab_sign_in` would have made it more difficult to change to `sign_in` where possible. ...we've also gone ahead and changed to `sign_in` where possible.
Diffstat (limited to 'spec/features/projects/branches_spec.rb')
-rw-r--r--spec/features/projects/branches_spec.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb
index 5c3d1b3f1ee..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
- gitlab_sign_in :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
- gitlab_sign_in :user
- project.team << [@user, :master]
+ sign_in(user)
+ project.team << [user, :master]
end
describe 'Delete protected branch' do