diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-09-18 21:05:34 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-09-18 21:05:34 +0300 |
commit | 27a28d9970c28142aa4482b6f474b79ccaec2bec (patch) | |
tree | 715cd65e1e7847bf91d525c800435de96f255ef6 /spec/support/shared_examples | |
parent | 4c0beb6c024b25ff24c7c2ea966bacab0ee860d5 (diff) | |
parent | 9b13753302df7a3e8ef86c6af3f84066bde31a21 (diff) |
Merge branch 'master' into sh-headless-chrome-support
* master: (97 commits)
Eliminate N+1 queries in loading discussions.json endpoint
Clean up read_registry scope changes
Add missing import statements
Improve “New project“ page description
Fix notification message when admin label was modified
Remove gaps under nav on build page
Replace the 'project/snippets.feature' spinach test with an rspec analog
Use correct group members path for members flyout link
Fix docs for lightweight tag creation via API
Replace the 'project/commits/revert.feature' spinach test with an rspec analog
Merge branch 'rs-incoming-email-domain-docs' into 'security-10-0'
Replace the 'project/archived.feature' spinach test with an rspec analog
Fix broken link in docs/api/wiki.md
Fixed the new sidebars width when browser has scrollbars
Improve 'spec/features/profiles/*' specs
Replace the 'search.feature' spinach test with an rspec analog
dedupe yarn packages
add dependency approvals (all MIT license)
update build image to latest with node 8.x, yarn 1.0.2, and chrome 61
Ensure we use `Entities::User` for non-admin `users/:id` API requests
...
Diffstat (limited to 'spec/support/shared_examples')
3 files changed, 82 insertions, 0 deletions
diff --git a/spec/support/shared_examples/features/issuables_user_dropdown_behaviors_shared_examples.rb b/spec/support/shared_examples/features/issuables_user_dropdown_behaviors_shared_examples.rb new file mode 100644 index 00000000000..c92c7f603d6 --- /dev/null +++ b/spec/support/shared_examples/features/issuables_user_dropdown_behaviors_shared_examples.rb @@ -0,0 +1,21 @@ +shared_examples 'issuable user dropdown behaviors' do + include FilteredSearchHelpers + + before do + issuable # ensure we have at least one issuable + sign_in(user_in_dropdown) + end + + %w[author assignee].each do |dropdown| + describe "#{dropdown} dropdown", :js do + it 'only includes members of the project/group' do + visit issuables_path + + filtered_search.set("#{dropdown}:") + + expect(find("#js-dropdown-#{dropdown} .filter-dropdown")).to have_content(user_in_dropdown.name) + expect(find("#js-dropdown-#{dropdown} .filter-dropdown")).not_to have_content(user_not_in_dropdown.name) + end + end + end +end diff --git a/spec/support/shared_examples/features/project_features_apply_to_issuables_shared_examples.rb b/spec/support/shared_examples/features/project_features_apply_to_issuables_shared_examples.rb new file mode 100644 index 00000000000..639b0924197 --- /dev/null +++ b/spec/support/shared_examples/features/project_features_apply_to_issuables_shared_examples.rb @@ -0,0 +1,56 @@ +shared_examples 'project features apply to issuables' do |klass| + let(:described_class) { klass } + + let(:group) { create(:group) } + let(:user_in_group) { create(:group_member, :developer, user: create(:user), group: group ).user } + let(:user_outside_group) { create(:user) } + + let(:project) { create(:project, :public, project_args) } + + def project_args + feature = "#{described_class.model_name.plural}_access_level".to_sym + + args = { group: group } + args[feature] = access_level + + args + end + + before do + _ = issuable + gitlab_sign_in(user) if user + visit path + end + + context 'public access level' do + let(:access_level) { ProjectFeature::ENABLED } + + context 'group member' do + let(:user) { user_in_group } + + it { expect(page).to have_content(issuable.title) } + end + + context 'non-member' do + let(:user) { user_outside_group } + + it { expect(page).to have_content(issuable.title) } + end + end + + context 'private access level' do + let(:access_level) { ProjectFeature::PRIVATE } + + context 'group member' do + let(:user) { user_in_group } + + it { expect(page).to have_content(issuable.title) } + end + + context 'non-member' do + let(:user) { user_outside_group } + + it { expect(page).not_to have_content(issuable.title) } + end + end +end diff --git a/spec/support/shared_examples/features/search_shared_examples.rb b/spec/support/shared_examples/features/search_shared_examples.rb new file mode 100644 index 00000000000..25ebbf011d5 --- /dev/null +++ b/spec/support/shared_examples/features/search_shared_examples.rb @@ -0,0 +1,5 @@ +shared_examples 'top right search form' do + it 'does not show top right search form' do + expect(page).not_to have_selector('.search') + end +end |