Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 18:06:26 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 18:06:26 +0300
commit84727c8209a4412e21111a07f99b0438b03232de (patch)
tree1fcfa02b01548c3cdc561186870a1c807f227f0b /spec/lib
parentd2798d607e11e0ebae83ae909404834388733428 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/banzai/pipeline/gfm_pipeline_spec.rb6
-rw-r--r--spec/lib/gitlab/discussions_diff/file_collection_spec.rb39
-rw-r--r--spec/lib/gitlab/import_export/all_models.yml8
-rw-r--r--spec/lib/gitlab/usage_data_spec.rb16
4 files changed, 44 insertions, 25 deletions
diff --git a/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb b/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb
index 7eb63fea413..47ea273ef3a 100644
--- a/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb
+++ b/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb
@@ -34,7 +34,7 @@ describe Banzai::Pipeline::GfmPipeline do
result = described_class.call(markdown, project: project)[:output]
link = result.css('a').first
- expect(link['href']).to eq 'http://issue-tracker.example.com/issues/12'
+ expect(link['href']).to eq 'http://issues.example.com/issues/12'
end
it 'parses cross-project references to regular issues' do
@@ -63,7 +63,7 @@ describe Banzai::Pipeline::GfmPipeline do
result = described_class.call(markdown, project: project)[:output]
link = result.css('a').first
- expect(link['href']).to eq 'http://issue-tracker.example.com/issues/12'
+ expect(link['href']).to eq 'http://issues.example.com/issues/12'
end
it 'allows to use long external reference syntax for Redmine' do
@@ -72,7 +72,7 @@ describe Banzai::Pipeline::GfmPipeline do
result = described_class.call(markdown, project: project)[:output]
link = result.css('a').first
- expect(link['href']).to eq 'http://issue-tracker.example.com/issues/12'
+ expect(link['href']).to eq 'http://issues.example.com/issues/12'
end
it 'parses cross-project references to regular issues' do
diff --git a/spec/lib/gitlab/discussions_diff/file_collection_spec.rb b/spec/lib/gitlab/discussions_diff/file_collection_spec.rb
index 0489206458b..6ef1e41450f 100644
--- a/spec/lib/gitlab/discussions_diff/file_collection_spec.rb
+++ b/spec/lib/gitlab/discussions_diff/file_collection_spec.rb
@@ -22,11 +22,13 @@ describe Gitlab::DiscussionsDiff::FileCollection do
note_diff_file_b.id => file_b_caching_content })
.and_call_original
- subject.load_highlight([note_diff_file_a.id, note_diff_file_b.id])
+ subject.load_highlight
end
it 'does not write cache for already cached file' do
- subject.load_highlight([note_diff_file_a.id])
+ file_a_caching_content = diff_note_a.diff_file.highlighted_diff_lines.map(&:to_hash)
+ Gitlab::DiscussionsDiff::HighlightCache
+ .write_multiple({ note_diff_file_a.id => file_a_caching_content })
file_b_caching_content = diff_note_b.diff_file.highlighted_diff_lines.map(&:to_hash)
@@ -35,27 +37,42 @@ describe Gitlab::DiscussionsDiff::FileCollection do
.with({ note_diff_file_b.id => file_b_caching_content })
.and_call_original
- subject.load_highlight([note_diff_file_a.id, note_diff_file_b.id])
+ subject.load_highlight
end
- it 'does not err when given ID does not exist in @collection' do
- expect { subject.load_highlight([999]) }.not_to raise_error
+ it 'does not write cache for resolved notes' do
+ diff_note_a.update_column(:resolved_at, Time.now)
+
+ file_b_caching_content = diff_note_b.diff_file.highlighted_diff_lines.map(&:to_hash)
+
+ expect(Gitlab::DiscussionsDiff::HighlightCache)
+ .to receive(:write_multiple)
+ .with({ note_diff_file_b.id => file_b_caching_content })
+ .and_call_original
+
+ subject.load_highlight
end
it 'loaded diff files have highlighted lines loaded' do
- subject.load_highlight([note_diff_file_a.id])
+ subject.load_highlight
- diff_file = subject.find_by_id(note_diff_file_a.id)
+ diff_file_a = subject.find_by_id(note_diff_file_a.id)
+ diff_file_b = subject.find_by_id(note_diff_file_b.id)
- expect(diff_file.highlight_loaded?).to be(true)
+ expect(diff_file_a).to be_highlight_loaded
+ expect(diff_file_b).to be_highlight_loaded
end
it 'not loaded diff files does not have highlighted lines loaded' do
- subject.load_highlight([note_diff_file_a.id])
+ diff_note_a.update_column(:resolved_at, Time.now)
+
+ subject.load_highlight
- diff_file = subject.find_by_id(note_diff_file_b.id)
+ diff_file_a = subject.find_by_id(note_diff_file_a.id)
+ diff_file_b = subject.find_by_id(note_diff_file_b.id)
- expect(diff_file.highlight_loaded?).to be(false)
+ expect(diff_file_a).not_to be_highlight_loaded
+ expect(diff_file_b).to be_highlight_loaded
end
end
end
diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml
index 6d573a4f39a..d3be1e86539 100644
--- a/spec/lib/gitlab/import_export/all_models.yml
+++ b/spec/lib/gitlab/import_export/all_models.yml
@@ -65,8 +65,8 @@ milestone:
- participants
- events
- boards
-- milestone_release
-- release
+- milestone_releases
+- releases
snippets:
- author
- project
@@ -77,8 +77,8 @@ releases:
- author
- project
- links
-- milestone_release
-- milestone
+- milestone_releases
+- milestones
links:
- release
project_members:
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb
index 8eb64b97d6a..62787c5abaf 100644
--- a/spec/lib/gitlab/usage_data_spec.rb
+++ b/spec/lib/gitlab/usage_data_spec.rb
@@ -3,14 +3,16 @@
require 'spec_helper'
describe Gitlab::UsageData do
- let(:projects) { create_list(:project, 3) }
+ let(:projects) { create_list(:project, 4) }
let!(:board) { create(:board, project: projects[0]) }
describe '#data' do
before do
create(:jira_service, project: projects[0])
- create(:jira_service, project: projects[1])
+ create(:jira_service, :without_properties_callback, project: projects[1])
create(:jira_service, :jira_cloud_service, project: projects[2])
+ create(:jira_service, :without_properties_callback, project: projects[3],
+ properties: { url: 'https://mysite.atlassian.net' })
create(:prometheus_service, project: projects[1])
create(:service, project: projects[0], type: 'SlackSlashCommandsService', active: true)
create(:service, project: projects[1], type: 'SlackService', active: true)
@@ -156,7 +158,7 @@ describe Gitlab::UsageData do
count_data = subject[:counts]
expect(count_data[:boards]).to eq(1)
- expect(count_data[:projects]).to eq(3)
+ expect(count_data[:projects]).to eq(4)
expect(count_data.keys).to include(*expected_keys)
expect(expected_keys - count_data.keys).to be_empty
end
@@ -164,14 +166,14 @@ describe Gitlab::UsageData do
it 'gathers projects data correctly' do
count_data = subject[:counts]
- expect(count_data[:projects]).to eq(3)
+ expect(count_data[:projects]).to eq(4)
expect(count_data[:projects_prometheus_active]).to eq(1)
- expect(count_data[:projects_jira_active]).to eq(3)
+ expect(count_data[:projects_jira_active]).to eq(4)
expect(count_data[:projects_jira_server_active]).to eq(2)
- expect(count_data[:projects_jira_cloud_active]).to eq(1)
+ expect(count_data[:projects_jira_cloud_active]).to eq(2)
expect(count_data[:projects_slack_notifications_active]).to eq(2)
expect(count_data[:projects_slack_slash_active]).to eq(1)
- expect(count_data[:projects_with_repositories_enabled]).to eq(2)
+ expect(count_data[:projects_with_repositories_enabled]).to eq(3)
expect(count_data[:projects_with_error_tracking_enabled]).to eq(1)
expect(count_data[:clusters_enabled]).to eq(7)