Commit 0715febb authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'resolve-spec-differences' into 'master'

Resolve EE specific differences in the spec/ directory

See merge request gitlab-org/gitlab-ce!31109
parents 7064d48e 701b6fce
# frozen_string_literal: true
require 'spec_helper'
require Rails.root.join('ee', 'spec', 'db', 'schema_support') if Gitlab.ee?
describe 'Database schema' do
let(:connection) { ActiveRecord::Base.connection }
let(:tables) { connection.tables }
# Use if you are certain that this column should not have a foreign key
# EE: edit the ee/spec/db/schema_support.rb
IGNORED_FK_COLUMNS = {
abuse_reports: %w[reporter_id user_id],
application_settings: %w[performance_bar_allowed_group_id slack_app_id snowplow_site_id],
......
......@@ -6,23 +6,36 @@ describe 'Dashboard > User filters todos', :js do
let(:user_1) { create(:user, username: 'user_1', name: 'user_1') }
let(:user_2) { create(:user, username: 'user_2', name: 'user_2') }
let(:project_1) { create(:project, name: 'project_1') }
let(:project_2) { create(:project, name: 'project_2') }
let(:group1) { create(:group) }
let(:group2) { create(:group) }
let(:issue) { create(:issue, title: 'issue', project: project_1) }
let(:project_1) { create(:project, name: 'project_1', namespace: group1) }
let(:project_2) { create(:project, name: 'project_2', namespace: group1) }
let(:project_3) { create(:project, name: 'project_3', namespace: group2) }
let(:issue1) { create(:issue, title: 'issue', project: project_1) }
let(:issue2) { create(:issue, title: 'issue', project: project_3) }
let!(:merge_request) { create(:merge_request, source_project: project_2, title: 'merge_request') }
before do
create(:todo, user: user_1, author: user_2, project: project_1, target: issue, action: 1)
create(:todo, user: user_1, author: user_2, project: project_1, target: issue1, action: 1)
create(:todo, user: user_1, author: user_2, project: project_3, target: issue2, action: 1)
create(:todo, user: user_1, author: user_1, project: project_2, target: merge_request, action: 2)
project_1.add_developer(user_1)
project_2.add_developer(user_1)
project_3.add_developer(user_1)
sign_in(user_1)
visit dashboard_todos_path
end
it 'displays all todos without a filter' do
expect(page).to have_content issue1.to_reference(full: true)
expect(page).to have_content merge_request.to_reference(full: true)
expect(page).to have_content issue2.to_reference(full: true)
end
it 'filters by project' do
click_button 'Project'
within '.dropdown-menu-project' do
......@@ -36,6 +49,20 @@ describe 'Dashboard > User filters todos', :js do
expect(page).not_to have_content project_2.full_name
end
it 'filters by group' do
click_button 'Group'
within '.dropdown-menu-group' do
fill_in 'Search groups', with: group1.full_name
click_link group1.full_name
end
wait_for_requests
expect(page).to have_content issue1.to_reference(full: true)
expect(page).to have_content merge_request.to_reference(full: true)
expect(page).not_to have_content issue2.to_reference(full: true)
end
context 'Author filter' do
it 'filters by author' do
click_button 'Author'
......@@ -65,7 +92,7 @@ describe 'Dashboard > User filters todos', :js do
it 'shows only authors of existing done todos' do
user_3 = create :user
user_4 = create :user
create(:todo, user: user_1, author: user_3, project: project_1, target: issue, action: 1, state: :done)
create(:todo, user: user_1, author: user_3, project: project_1, target: issue1, action: 1, state: :done)
create(:todo, user: user_1, author: user_4, project: project_2, target: merge_request, action: 2, state: :done)
project_1.add_developer(user_3)
......@@ -94,14 +121,15 @@ describe 'Dashboard > User filters todos', :js do
wait_for_requests
expect(find('.todos-list')).to have_content issue.to_reference
expect(find('.todos-list')).to have_content issue1.to_reference
expect(find('.todos-list')).to have_content issue2.to_reference
expect(find('.todos-list')).not_to have_content merge_request.to_reference
end
describe 'filter by action' do
before do
create(:todo, :build_failed, user: user_1, author: user_2, project: project_1)
create(:todo, :marked, user: user_1, author: user_2, project: project_1, target: issue)
create(:todo, :marked, user: user_1, author: user_2, project: project_1, target: issue1)
end
it 'filters by Assigned' do
......
......@@ -16,6 +16,7 @@ describe 'Protected Tags', :js do
it "allows creating explicit protected tags" do
visit project_protected_tags_path(project)
set_protected_tag_name('some-tag')
set_allowed_to('create') if Gitlab.ee?
click_on "Protect"
within(".protected-tags-list") { expect(page).to have_content('some-tag') }
......@@ -29,6 +30,7 @@ describe 'Protected Tags', :js do
visit project_protected_tags_path(project)
set_protected_tag_name('some-tag')
set_allowed_to('create') if Gitlab.ee?
click_on "Protect"
within(".protected-tags-list") { expect(page).to have_content(commit.id[0..7]) }
......@@ -37,6 +39,7 @@ describe 'Protected Tags', :js do
it "displays an error message if the named tag does not exist" do
visit project_protected_tags_path(project)
set_protected_tag_name('some-tag')
set_allowed_to('create') if Gitlab.ee?
click_on "Protect"
within(".protected-tags-list") { expect(page).to have_content('tag was removed') }
......@@ -47,6 +50,7 @@ describe 'Protected Tags', :js do
it "allows creating protected tags with a wildcard" do
visit project_protected_tags_path(project)
set_protected_tag_name('*-stable')
set_allowed_to('create') if Gitlab.ee?
click_on "Protect"
within(".protected-tags-list") { expect(page).to have_content('*-stable') }
......@@ -60,6 +64,7 @@ describe 'Protected Tags', :js do
visit project_protected_tags_path(project)
set_protected_tag_name('*-stable')
set_allowed_to('create') if Gitlab.ee?
click_on "Protect"
within(".protected-tags-list") do
......@@ -75,6 +80,7 @@ describe 'Protected Tags', :js do
visit project_protected_tags_path(project)
set_protected_tag_name('*-stable')
set_allowed_to('create') if Gitlab.ee?
click_on "Protect"
visit project_protected_tags_path(project)
......
......@@ -8,7 +8,15 @@ describe 'Usage stats consent' do
let(:message) { 'To help improve GitLab, we would like to periodically collect usage information.' }
before do
allow(user).to receive(:has_current_license?).and_return false
if Gitlab.ee?
allow_any_instance_of(EE::User)
.to receive(:has_current_license?)
.and_return(false)
else
allow(user)
.to receive(:has_current_license?)
.and_return(false)
end
gitlab_sign_in(user)
end
......
......@@ -90,7 +90,7 @@ describe Banzai::Filter::WikiLinkFilter do
"javascript:",
"java\0script:",
"  javascript:"
]
]
invalid_slugs.each do |slug|
context "with the slug #{slug}" 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