diff options
author | Rémy Coutable <remy@rymai.me> | 2017-02-21 19:59:03 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-02-21 19:59:03 +0300 |
commit | 2d2ed828880f620238dc7ef5c9f75fb6e7fef59a (patch) | |
tree | ce99ede6c982502d6a909bc4ffab8ce3e2468822 /spec | |
parent | 316a7312341fd2d359b44da3f386c3739c1bdb4d (diff) | |
parent | 3f7b7a3b0f2199c56b9f5acab07539610ae10c7c (diff) |
Merge branch '26879-fix-preselected-namespace-when-creating-project' into 'master'
Fix preselected namespace when creating a project
Closes #26879
See merge request !9389
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/projects/new_project_spec.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/features/projects/new_project_spec.rb b/spec/features/projects/new_project_spec.rb index b56e562b2b6..45185f2dd1f 100644 --- a/spec/features/projects/new_project_spec.rb +++ b/spec/features/projects/new_project_spec.rb @@ -19,6 +19,51 @@ feature "New project", feature: true do end end + context "Namespace selector" do + context "with user namespace" do + before do + visit new_project_path + end + + it "selects the user namespace" do + namespace = find("#project_namespace_id") + + expect(namespace.text).to eq user.username + end + end + + context "with group namespace" do + let(:group) { create(:group, :private, owner: user) } + + before do + group.add_owner(user) + visit new_project_path(namespace_id: group.id) + end + + it "selects the group namespace" do + namespace = find("#project_namespace_id option[selected]") + + expect(namespace.text).to eq group.name + end + + context "on validation error" do + before do + fill_in('project_path', with: 'private-group-project') + choose('Internal') + click_button('Create project') + + expect(page).to have_css '.project-edit-errors .alert.alert-danger' + end + + it "selects the group namespace" do + namespace = find("#project_namespace_id option[selected]") + + expect(namespace.text).to eq group.name + end + end + end + end + context 'Import project options' do before do visit new_project_path |