BigW Consortium Gitlab

Commit d384b6a0 by Rémy Coutable

Merge branch 'rs-overcreating-users' into 'master'

Create guest users only when necessary rather than for every spec See merge request !13024
parents 883488e0 c10943d9
require 'spec_helper'
feature 'Top Plus Menu', feature: true, js: true do
let(:user) { create :user }
let(:guest_user) { create :user}
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, :repository, creator: user, namespace: user.namespace) }
let(:public_project) { create(:project, :public) }
before do
group.add_owner(user)
group.add_guest(guest_user)
project.add_guest(guest_user)
end
context 'used by full user' do
......@@ -102,7 +98,12 @@ feature 'Top Plus Menu', feature: true, js: true do
end
context 'used by guest user' do
let(:guest_user) { create(:user) }
before do
group.add_guest(guest_user)
project.add_guest(guest_user)
sign_in(guest_user)
end
......
......@@ -5,8 +5,6 @@ shared_examples 'issuable record that supports quick actions in its description
include QuickActionsHelpers
let(:master) { create(:user) }
let(:assignee) { create(:user, username: 'bob') }
let(:guest) { create(:user) }
let(:project) { create(:project, :public) }
let!(:milestone) { create(:milestone, project: project, title: 'ASAP') }
let!(:label_bug) { create(:label, project: project, title: 'bug') }
......@@ -15,8 +13,6 @@ shared_examples 'issuable record that supports quick actions in its description
before do
project.team << [master, :master]
project.team << [assignee, :developer]
project.team << [guest, :guest]
sign_in(master)
end
......@@ -57,6 +53,7 @@ shared_examples 'issuable record that supports quick actions in its description
context 'with a note containing commands' do
it 'creates a note without the commands and interpret the commands accordingly' do
assignee = create(:user, username: 'bob')
write_note("Awesome!\n/assign @bob\n/label ~bug\n/milestone %\"ASAP\"")
expect(page).to have_content 'Awesome!'
......@@ -77,6 +74,7 @@ shared_examples 'issuable record that supports quick actions in its description
context 'with a note containing only commands' do
it 'does not create a note but interpret the commands accordingly' do
assignee = create(:user, username: 'bob')
write_note("/assign @bob\n/label ~bug\n/milestone %\"ASAP\"")
expect(page).not_to have_content '/assign @bob'
......@@ -111,8 +109,12 @@ shared_examples 'issuable record that supports quick actions in its description
context "when current user cannot close #{issuable_type}" do
before do
guest = create(:user)
project.add_guest(guest)
sign_out(:user)
sign_in(guest)
visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable)
end
......@@ -146,8 +148,12 @@ shared_examples 'issuable record that supports quick actions in its description
context "when current user cannot reopen #{issuable_type}" do
before do
guest = create(:user)
project.add_guest(guest)
sign_out(:user)
sign_in(guest)
visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable)
end
......@@ -176,6 +182,9 @@ shared_examples 'issuable record that supports quick actions in its description
context "when current user cannot change title of #{issuable_type}" do
before do
guest = create(:user)
project.add_guest(guest)
sign_out(:user)
sign_in(guest)
visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable)
......@@ -267,6 +276,8 @@ shared_examples 'issuable record that supports quick actions in its description
describe "preview of note on #{issuable_type}" do
it 'removes quick actions from note and explains them' do
create(:user, username: 'bob')
visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable)
page.within('.js-main-target-form') do
......
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