Commit ce6974eb authored by Nick Thomas's avatar Nick Thomas

Merge branch 'get-rid-of-hardcoded-path-or-names-in-factories' into 'master'

Get rid of hard-coded user/project/group names that could clash with DB sequences

See merge request gitlab-org/gitlab-ce!17290
parents a03b429c 566be168
...@@ -146,8 +146,8 @@ feature 'Project' do ...@@ -146,8 +146,8 @@ feature 'Project' do
end end
describe 'removal', :js do describe 'removal', :js do
let(:user) { create(:user, username: 'test', name: 'test') } let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace, name: 'project1') } let(:project) { create(:project, namespace: user.namespace) }
before do before do
sign_in(user) sign_in(user)
...@@ -156,8 +156,8 @@ feature 'Project' do ...@@ -156,8 +156,8 @@ feature 'Project' do
end end
it 'removes a project' do it 'removes a project' do
expect { remove_with_confirm('Remove project', project.path) }.to change {Project.count}.by(-1) expect { remove_with_confirm('Remove project', project.path) }.to change { Project.count }.by(-1)
expect(page).to have_content "Project 'test / project1' is in the process of being deleted." expect(page).to have_content "Project '#{project.full_name}' is in the process of being deleted."
expect(Project.all.count).to be_zero expect(Project.all.count).to be_zero
expect(project.issues).to be_empty expect(project.issues).to be_empty
expect(project.merge_requests).to be_empty expect(project.merge_requests).to be_empty
......
...@@ -68,10 +68,10 @@ describe 'OpenID Connect requests' do ...@@ -68,10 +68,10 @@ describe 'OpenID Connect requests' do
let!(:public_email) { build :email, email: 'public@example.com' } let!(:public_email) { build :email, email: 'public@example.com' }
let!(:private_email) { build :email, email: 'private@example.com' } let!(:private_email) { build :email, email: 'private@example.com' }
let!(:group1) { create :group, path: 'group1' } let!(:group1) { create :group }
let!(:group2) { create :group, path: 'group2' } let!(:group2) { create :group }
let!(:group3) { create :group, path: 'group3', parent: group2 } let!(:group3) { create :group, parent: group2 }
let!(:group4) { create :group, path: 'group4', parent: group3 } let!(:group4) { create :group, parent: group3 }
before do before do
group1.add_user(user, GroupMember::OWNER) group1.add_user(user, GroupMember::OWNER)
...@@ -93,8 +93,8 @@ describe 'OpenID Connect requests' do ...@@ -93,8 +93,8 @@ describe 'OpenID Connect requests' do
'groups' => anything 'groups' => anything
})) }))
expected_groups = %w[group1 group2/group3] expected_groups = [group1.full_path, group3.full_path]
expected_groups << 'group2/group3/group4' if Group.supports_nested_groups? expected_groups << group4.full_path if Group.supports_nested_groups?
expect(json_response['groups']).to match_array(expected_groups) expect(json_response['groups']).to match_array(expected_groups)
end end
end end
......
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