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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-05 22:58:23 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-05 22:58:23 +0300
commit09432c7f561449734e2ae298496dc0f1d7da0d6a (patch)
treeb444ddf7f6f8d25aa1af899f9c1f9a41feafaec7 /spec
parente2aba30891c3deff4174df08b92817095eec38d5 (diff)
Add latest changes from gitlab-org/gitlab@12-8-stable-ee
Diffstat (limited to 'spec')
-rw-r--r--spec/features/dashboard/projects_spec.rb55
-rw-r--r--spec/features/error_tracking/user_searches_sentry_errors_spec.rb40
-rw-r--r--spec/features/projects/tree/tree_show_spec.rb10
-rw-r--r--spec/fixtures/sentry/error_list_search_response.json42
-rw-r--r--spec/fixtures/sentry/issues_sample_response.json48
-rw-r--r--spec/frontend/error_tracking/components/error_tracking_list_spec.js6
-rw-r--r--spec/frontend/ide/lib/files_spec.js3
-rw-r--r--spec/frontend/ide/stores/mutations_spec.js6
-rw-r--r--spec/frontend/repository/components/breadcrumbs_spec.js2
-rw-r--r--spec/frontend/repository/components/table/row_spec.js20
-rw-r--r--spec/frontend/vue_shared/components/file_row_spec.js117
-rw-r--r--spec/javascripts/vue_shared/components/file_row_spec.js87
-rw-r--r--spec/lib/gitlab/asset_proxy_spec.rb8
-rw-r--r--spec/lib/gitlab/tree_summary_spec.rb11
-rw-r--r--spec/lib/marginalia_spec.rb3
-rw-r--r--spec/lib/sentry/client/issue_spec.rb6
-rw-r--r--spec/models/broadcast_message_spec.rb11
-rw-r--r--spec/models/repository_spec.rb9
-rw-r--r--spec/support_specs/helpers/active_record/query_recorder_spec.rb7
-rw-r--r--spec/uploaders/import_export_uploader_spec.rb6
20 files changed, 384 insertions, 113 deletions
diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb
index 9bd2e85e3b8..73f759f8a54 100644
--- a/spec/features/dashboard/projects_spec.rb
+++ b/spec/features/dashboard/projects_spec.rb
@@ -152,6 +152,61 @@ describe 'Dashboard Projects' do
end
end
+ describe 'with a pipeline', :clean_gitlab_redis_shared_state do
+ let(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit.sha, ref: project.default_branch) }
+
+ before do
+ # Since the cache isn't updated when a new pipeline is created
+ # we need the pipeline to advance in the pipeline since the cache was created
+ # by visiting the login page.
+ pipeline.succeed
+ end
+
+ it 'shows that the last pipeline passed' do
+ visit dashboard_projects_path
+
+ page.within('.controls') do
+ expect(page).to have_xpath("//a[@href='#{pipelines_project_commit_path(project, project.commit, ref: pipeline.ref)}']")
+ expect(page).to have_css('.ci-status-link')
+ expect(page).to have_css('.ci-status-icon-success')
+ expect(page).to have_link('Pipeline: passed')
+ end
+ end
+
+ shared_examples 'hidden pipeline status' do
+ it 'does not show the pipeline status' do
+ visit dashboard_projects_path
+
+ page.within('.controls') do
+ expect(page).not_to have_xpath("//a[@href='#{pipelines_project_commit_path(project, project.commit, ref: pipeline.ref)}']")
+ expect(page).not_to have_css('.ci-status-link')
+ expect(page).not_to have_css('.ci-status-icon-success')
+ expect(page).not_to have_link('Pipeline: passed')
+ end
+ end
+ end
+
+ context 'guest user of project and project has private pipelines' do
+ let(:guest_user) { create(:user) }
+
+ before do
+ project.update(public_builds: false)
+ project.add_guest(guest_user)
+ sign_in(guest_user)
+ end
+
+ it_behaves_like 'hidden pipeline status'
+ end
+
+ context 'when dashboard_pipeline_status is disabled' do
+ before do
+ stub_feature_flags(dashboard_pipeline_status: false)
+ end
+
+ it_behaves_like 'hidden pipeline status'
+ end
+ end
+
context 'last push widget', :use_clean_rails_memory_store_caching do
before do
event = create(:push_event, project: project, author: user)
diff --git a/spec/features/error_tracking/user_searches_sentry_errors_spec.rb b/spec/features/error_tracking/user_searches_sentry_errors_spec.rb
new file mode 100644
index 00000000000..690c60a3c3f
--- /dev/null
+++ b/spec/features/error_tracking/user_searches_sentry_errors_spec.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe 'When a user searches for Sentry errors', :js, :use_clean_rails_memory_store_caching, :sidekiq_inline do
+ include_context 'sentry error tracking context feature'
+
+ let_it_be(:issues_response_body) { fixture_file('sentry/issues_sample_response.json') }
+ let_it_be(:error_search_response_body) { fixture_file('sentry/error_list_search_response.json') }
+ let(:issues_api_url) { "#{sentry_api_urls.issues_url}?limit=20&query=is:unresolved" }
+ let(:issues_api_url_search) { "#{sentry_api_urls.issues_url}?limit=20&query=is:unresolved%20NotFound" }
+
+ before do
+ stub_request(:get, issues_api_url).with(
+ headers: { 'Authorization' => 'Bearer access_token_123' }
+ ).to_return(status: 200, body: issues_response_body, headers: { 'Content-Type' => 'application/json' })
+
+ stub_request(:get, issues_api_url_search).with(
+ headers: { 'Authorization' => 'Bearer access_token_123', 'Content-Type' => 'application/json' }
+ ).to_return(status: 200, body: error_search_response_body, headers: { 'Content-Type' => 'application/json' })
+ end
+
+ it 'displays the results' do
+ sign_in(project.owner)
+ visit project_error_tracking_index_path(project)
+
+ page.within(find('.gl-table')) do
+ results = page.all('.table-row')
+ expect(results.count).to be(2)
+ end
+
+ find('.gl-form-input').set('NotFound').native.send_keys(:return)
+
+ page.within(find('.gl-table')) do
+ results = page.all('.table-row')
+ expect(results.count).to be(1)
+ expect(results.first).to have_content('NotFound')
+ end
+ end
+end
diff --git a/spec/features/projects/tree/tree_show_spec.rb b/spec/features/projects/tree/tree_show_spec.rb
index 23b13858096..2407a9e6ea3 100644
--- a/spec/features/projects/tree/tree_show_spec.rb
+++ b/spec/features/projects/tree/tree_show_spec.rb
@@ -37,6 +37,16 @@ describe 'Projects tree', :js do
expect(page).not_to have_selector('.flash-alert')
end
+ it 'renders tree table with non-ASCII filenames without errors' do
+ visit project_tree_path(project, File.join(test_sha, 'encoding'))
+ wait_for_requests
+
+ expect(page).to have_selector('.tree-item')
+ expect(page).to have_content('Files, encoding and much more')
+ expect(page).to have_content('テスト.txt')
+ expect(page).not_to have_selector('.flash-alert')
+ end
+
context 'gravatar disabled' do
let(:gravatar_enabled) { false }
diff --git a/spec/fixtures/sentry/error_list_search_response.json b/spec/fixtures/sentry/error_list_search_response.json
new file mode 100644
index 00000000000..e77c837b48c
--- /dev/null
+++ b/spec/fixtures/sentry/error_list_search_response.json
@@ -0,0 +1,42 @@
+[{
+ "lastSeen": "2018-12-31T12:00:11Z",
+ "numComments": 0,
+ "userCount": 0,
+ "stats": {
+ "24h": [
+ [
+ 1546437600,
+ 0
+ ]
+ ]
+ },
+ "culprit": "sentry.tasks.reports.deliver_organization_user_report",
+ "title": "NotFound desc = GetRepoPath: not a git repository",
+ "id": "13",
+ "assignedTo": null,
+ "logger": null,
+ "type": "error",
+ "annotations": [],
+ "metadata": {
+ "type": "gaierror",
+ "value": "[Errno -2] Name or service not known"
+ },
+ "status": "unresolved",
+ "subscriptionDetails": null,
+ "isPublic": false,
+ "hasSeen": false,
+ "shortId": "INTERNAL-4",
+ "shareId": null,
+ "firstSeen": "2018-12-17T12:00:14Z",
+ "count": "17283712",
+ "permalink": "35.228.54.90/sentry/internal/issues/13/",
+ "level": "error",
+ "isSubscribed": true,
+ "isBookmarked": false,
+ "project": {
+ "slug": "internal",
+ "id": "1",
+ "name": "Internal"
+ },
+ "statusDetails": {}
+}]
diff --git a/spec/fixtures/sentry/issues_sample_response.json b/spec/fixtures/sentry/issues_sample_response.json
index ed22499cfa1..495562ac960 100644
--- a/spec/fixtures/sentry/issues_sample_response.json
+++ b/spec/fixtures/sentry/issues_sample_response.json
@@ -1,4 +1,5 @@
-[{
+[
+ {
"lastSeen": "2018-12-31T12:00:11Z",
"numComments": 0,
"userCount": 0,
@@ -39,4 +40,47 @@
"name": "Internal"
},
"statusDetails": {}
- }]
+ },
+ {
+ "lastSeen": "2018-12-31T12:00:11Z",
+ "numComments": 0,
+ "userCount": 0,
+ "stats": {
+ "24h": [
+ [
+ 1546437600,
+ 0
+ ]
+ ]
+ },
+ "culprit": "sentry.tasks.reports.deliver_organization_user_report",
+ "title": "NotFound desc = GetRepoPath: not a git repository",
+ "id": "13",
+ "assignedTo": null,
+ "logger": null,
+ "type": "error",
+ "annotations": [],
+ "metadata": {
+ "type": "gaierror",
+ "value": "GetRepoPath: not a git repository"
+ },
+ "status": "unresolved",
+ "subscriptionDetails": null,
+ "isPublic": false,
+ "hasSeen": false,
+ "shortId": "INTERNAL-4",
+ "shareId": null,
+ "firstSeen": "2018-12-17T12:00:14Z",
+ "count": "17283712",
+ "permalink": "35.228.54.90/sentry/internal/issues/13/",
+ "level": "error",
+ "isSubscribed": true,
+ "isBookmarked": false,
+ "project": {
+ "slug": "internal",
+ "id": "1",
+ "name": "Internal"
+ },
+ "statusDetails": {}
+ }
+]
diff --git a/spec/frontend/error_tracking/components/error_tracking_list_spec.js b/spec/frontend/error_tracking/components/error_tracking_list_spec.js
index b632b461eb9..f852a3091aa 100644
--- a/spec/frontend/error_tracking/components/error_tracking_list_spec.js
+++ b/spec/frontend/error_tracking/components/error_tracking_list_spec.js
@@ -42,9 +42,6 @@ describe('ErrorTrackingList', () => {
...stubChildren(ErrorTrackingList),
...stubs,
},
- data() {
- return { errorSearchQuery: 'search' };
- },
});
}
@@ -164,8 +161,9 @@ describe('ErrorTrackingList', () => {
});
it('it searches by query', () => {
+ findSearchBox().vm.$emit('input', 'search');
findSearchBox().trigger('keyup.enter');
- expect(actions.searchByQuery.mock.calls[0][1]).toEqual(wrapper.vm.errorSearchQuery);
+ expect(actions.searchByQuery.mock.calls[0][1]).toBe('search');
});
it('it sorts by fields', () => {
diff --git a/spec/frontend/ide/lib/files_spec.js b/spec/frontend/ide/lib/files_spec.js
index 34eb57ae0d3..2b15aef6454 100644
--- a/spec/frontend/ide/lib/files_spec.js
+++ b/spec/frontend/ide/lib/files_spec.js
@@ -1,7 +1,6 @@
import { viewerInformationForPath } from '~/vue_shared/components/content_viewer/lib/viewer_utils';
import { decorateFiles, splitParent } from '~/ide/lib/files';
import { decorateData } from '~/ide/stores/utils';
-import { escapeFileUrl } from '~/lib/utils/url_utility';
const TEST_BRANCH_ID = 'lorem-ipsum';
const TEST_PROJECT_ID = 10;
@@ -22,7 +21,7 @@ const createEntries = paths => {
id: path,
name,
path,
- url: createUrl(`/${TEST_PROJECT_ID}/${type}/${TEST_BRANCH_ID}/-/${escapeFileUrl(path)}`),
+ url: createUrl(`/${TEST_PROJECT_ID}/${type}/${TEST_BRANCH_ID}/-/${path}`),
type,
previewMode,
binary: (previewMode && previewMode.binary) || false,
diff --git a/spec/frontend/ide/stores/mutations_spec.js b/spec/frontend/ide/stores/mutations_spec.js
index 9fe75d596fb..d9ce59ad378 100644
--- a/spec/frontend/ide/stores/mutations_spec.js
+++ b/spec/frontend/ide/stores/mutations_spec.js
@@ -494,7 +494,7 @@ describe('Multi-file store mutations', () => {
it('properly handles files with spaces in name', () => {
const path = 'my fancy path';
const newPath = 'new path';
- const oldEntry = { ...file(path, path, 'blob'), url: `project/-/${encodeURI(path)}` };
+ const oldEntry = { ...file(path, path, 'blob'), url: `project/-/${path}` };
localState.entries[path] = oldEntry;
@@ -510,12 +510,12 @@ describe('Multi-file store mutations', () => {
id: newPath,
path: newPath,
name: newPath,
- url: `project/-/new%20path`,
+ url: `project/-/new path`,
key: expect.stringMatching(newPath),
prevId: path,
prevName: path,
prevPath: path,
- prevUrl: `project/-/my%20fancy%20path`,
+ prevUrl: `project/-/my fancy path`,
prevKey: oldEntry.key,
prevParentPath: oldEntry.parentPath,
});
diff --git a/spec/frontend/repository/components/breadcrumbs_spec.js b/spec/frontend/repository/components/breadcrumbs_spec.js
index 0271db25468..38e5c9aaca5 100644
--- a/spec/frontend/repository/components/breadcrumbs_spec.js
+++ b/spec/frontend/repository/components/breadcrumbs_spec.js
@@ -41,7 +41,7 @@ describe('Repository breadcrumbs component', () => {
.findAll(RouterLinkStub)
.at(3)
.props('to'),
- ).toEqual('/-/tree//app/assets/javascripts%23');
+ ).toEqual('/-/tree/app/assets/javascripts%23');
});
it('renders last link as active', () => {
diff --git a/spec/frontend/repository/components/table/row_spec.js b/spec/frontend/repository/components/table/row_spec.js
index fec9ba3aa2e..a51846023ac 100644
--- a/spec/frontend/repository/components/table/row_spec.js
+++ b/spec/frontend/repository/components/table/row_spec.js
@@ -109,6 +109,26 @@ describe('Repository table row component', () => {
});
});
+ it.each`
+ path
+ ${'test#'}
+ ${'Änderungen'}
+ `('renders link for $path', ({ path }) => {
+ factory({
+ id: '1',
+ sha: '123',
+ path,
+ type: 'tree',
+ currentPath: '/',
+ });
+
+ return vm.vm.$nextTick().then(() => {
+ expect(vm.find({ ref: 'link' }).props('to')).toEqual({
+ path: `/-/tree/master/${encodeURIComponent(path)}`,
+ });
+ });
+ });
+
it('pushes new route for directory with hash', () => {
factory({
id: '1',
diff --git a/spec/frontend/vue_shared/components/file_row_spec.js b/spec/frontend/vue_shared/components/file_row_spec.js
new file mode 100644
index 00000000000..b3ced84ddb5
--- /dev/null
+++ b/spec/frontend/vue_shared/components/file_row_spec.js
@@ -0,0 +1,117 @@
+import { file } from 'jest/ide/helpers';
+import FileRow from '~/vue_shared/components/file_row.vue';
+import FileHeader from '~/vue_shared/components/file_row_header.vue';
+import { shallowMount } from '@vue/test-utils';
+import { nextTick } from 'vue';
+import { escapeFileUrl } from '~/lib/utils/url_utility';
+
+describe('File row component', () => {
+ let wrapper;
+
+ function createComponent(propsData, $router = undefined) {
+ wrapper = shallowMount(FileRow, {
+ propsData,
+ mocks: {
+ $router,
+ },
+ });
+ }
+
+ afterEach(() => {
+ wrapper.destroy();
+ });
+
+ it('renders name', () => {
+ const fileName = 't4';
+ createComponent({
+ file: file(fileName),
+ level: 0,
+ });
+
+ const name = wrapper.find('.file-row-name');
+
+ expect(name.text().trim()).toEqual(fileName);
+ });
+
+ it('emits toggleTreeOpen on click', () => {
+ const fileName = 't3';
+ createComponent({
+ file: {
+ ...file(fileName),
+ type: 'tree',
+ },
+ level: 0,
+ });
+ jest.spyOn(wrapper.vm, '$emit');
+
+ wrapper.element.click();
+
+ expect(wrapper.vm.$emit).toHaveBeenCalledWith('toggleTreeOpen', fileName);
+ });
+
+ it('calls scrollIntoView if made active', () => {
+ createComponent({
+ file: {
+ ...file(),
+ type: 'blob',
+ active: false,
+ },
+ level: 0,
+ });
+
+ jest.spyOn(wrapper.vm, 'scrollIntoView');
+
+ wrapper.setProps({
+ file: Object.assign({}, wrapper.props('file'), {
+ active: true,
+ }),
+ });
+
+ return nextTick().then(() => {
+ expect(wrapper.vm.scrollIntoView).toHaveBeenCalled();
+ });
+ });
+
+ it('indents row based on level', () => {
+ createComponent({
+ file: file('t4'),
+ level: 2,
+ });
+
+ expect(wrapper.find('.file-row-name').element.style.marginLeft).toBe('32px');
+ });
+
+ it('renders header for file', () => {
+ createComponent({
+ file: {
+ isHeader: true,
+ path: 'app/assets',
+ tree: [],
+ },
+ level: 0,
+ });
+
+ expect(wrapper.contains(FileHeader)).toBe(true);
+ });
+
+ it('matches the current route against encoded file URL', () => {
+ const fileName = 'with space';
+ const rowFile = Object.assign({}, file(fileName), {
+ url: `/${fileName}`,
+ });
+ const routerPath = `/project/${escapeFileUrl(fileName)}`;
+ createComponent(
+ {
+ file: rowFile,
+ level: 0,
+ },
+ {
+ currentRoute: {
+ path: routerPath,
+ },
+ },
+ );
+
+ expect(wrapper.vm.hasUrlAtCurrentRoute()).toBe(true);
+ });
+});
diff --git a/spec/javascripts/vue_shared/components/file_row_spec.js b/spec/javascripts/vue_shared/components/file_row_spec.js
deleted file mode 100644
index 11fcb9b89c1..00000000000
--- a/spec/javascripts/vue_shared/components/file_row_spec.js
+++ /dev/null
@@ -1,87 +0,0 @@
-import Vue from 'vue';
-import { file } from 'spec/ide/helpers';
-import FileRow from '~/vue_shared/components/file_row.vue';
-import mountComponent from '../../helpers/vue_mount_component_helper';
-
-describe('File row component', () => {
- let vm;
-
- function createComponent(propsData) {
- const FileRowComponent = Vue.extend(FileRow);
-
- vm = mountComponent(FileRowComponent, propsData);
- }
-
- afterEach(() => {
- vm.$destroy();
- });
-
- it('renders name', () => {
- createComponent({
- file: file('t4'),
- level: 0,
- });
-
- const name = vm.$el.querySelector('.file-row-name');
-
- expect(name.textContent.trim()).toEqual(vm.file.name);
- });
-
- it('emits toggleTreeOpen on click', () => {
- createComponent({
- file: {
- ...file('t3'),
- type: 'tree',
- },
- level: 0,
- });
- spyOn(vm, '$emit').and.stub();
-
- vm.$el.click();
-
- expect(vm.$emit).toHaveBeenCalledWith('toggleTreeOpen', vm.file.path);
- });
-
- it('calls scrollIntoView if made active', done => {
- createComponent({
- file: {
- ...file(),
- type: 'blob',
- active: false,
- },
- level: 0,
- });
-
- spyOn(vm, 'scrollIntoView').and.stub();
-
- vm.file.active = true;
-
- vm.$nextTick(() => {
- expect(vm.scrollIntoView).toHaveBeenCalled();
-
- done();
- });
- });
-
- it('indents row based on level', () => {
- createComponent({
- file: file('t4'),
- level: 2,
- });
-
- expect(vm.$el.querySelector('.file-row-name').style.marginLeft).toBe('32px');
- });
-
- it('renders header for file', () => {
- createComponent({
- file: {
- isHeader: true,
- path: 'app/assets',
- tree: [],
- },
- level: 0,
- });
-
- expect(vm.$el.classList).toContain('js-file-row-header');
- });
-});
diff --git a/spec/lib/gitlab/asset_proxy_spec.rb b/spec/lib/gitlab/asset_proxy_spec.rb
index f5aa1819982..e406917a5a4 100644
--- a/spec/lib/gitlab/asset_proxy_spec.rb
+++ b/spec/lib/gitlab/asset_proxy_spec.rb
@@ -33,9 +33,15 @@ describe Gitlab::AssetProxy do
expect(described_class.proxy_url(url)).to eq(proxied_url)
end
+ it 'returns original URL for invalid domains' do
+ url = 'foo_bar://'
+
+ expect(described_class.proxy_url(url)).to eq(url)
+ end
+
context 'whitelisted domain' do
it 'returns original URL for single domain whitelist' do
- url = 'http://gitlab.com/test.png'
+ url = 'http://gitlab.com/${default_branch}/test.png'
expect(described_class.proxy_url(url)).to eq(url)
end
diff --git a/spec/lib/gitlab/tree_summary_spec.rb b/spec/lib/gitlab/tree_summary_spec.rb
index e15463ed0eb..d64b826ba9b 100644
--- a/spec/lib/gitlab/tree_summary_spec.rb
+++ b/spec/lib/gitlab/tree_summary_spec.rb
@@ -129,6 +129,17 @@ describe Gitlab::TreeSummary do
expect(commits).to satisfy_one { |c| c.id == whitespace_commit_sha }
end
end
+
+ context 'in a subdirectory with non-ASCII filenames' do
+ let(:path) { 'encoding' }
+
+ it 'returns commits for entries in the subdirectory' do
+ entry = entries.find { |x| x[:file_name] == 'テスト.txt' }
+
+ expect(entry).to be_a(Hash)
+ expect(entry).to include(:commit)
+ end
+ end
end
describe '#more?' do
diff --git a/spec/lib/marginalia_spec.rb b/spec/lib/marginalia_spec.rb
index db428bb65c4..d4b84c5cdc4 100644
--- a/spec/lib/marginalia_spec.rb
+++ b/spec/lib/marginalia_spec.rb
@@ -59,7 +59,6 @@ describe 'Marginalia spec' do
"application" => "test",
"controller" => "marginalia_test",
"action" => "first_user",
- "line" => "/spec/support/helpers/query_recorder.rb",
"correlation_id" => correlation_id
}
end
@@ -116,7 +115,6 @@ describe 'Marginalia spec' do
{
"application" => "sidekiq",
"job_class" => "MarginaliaTestJob",
- "line" => "/spec/support/sidekiq_middleware.rb",
"correlation_id" => sidekiq_job['correlation_id'],
"jid" => sidekiq_job['jid']
}
@@ -145,7 +143,6 @@ describe 'Marginalia spec' do
let(:component_map) do
{
"application" => "sidekiq",
- "line" => "/lib/gitlab/i18n.rb",
"jid" => delivery_job.job_id,
"job_class" => delivery_job.arguments.first
}
diff --git a/spec/lib/sentry/client/issue_spec.rb b/spec/lib/sentry/client/issue_spec.rb
index 2762c5b5cb9..d35e4b83d7f 100644
--- a/spec/lib/sentry/client/issue_spec.rb
+++ b/spec/lib/sentry/client/issue_spec.rb
@@ -49,7 +49,7 @@ describe Sentry::Client::Issue do
it_behaves_like 'calls sentry api'
it_behaves_like 'issues have correct return type', Gitlab::ErrorTracking::Error
- it_behaves_like 'issues have correct length', 1
+ it_behaves_like 'issues have correct length', 2
shared_examples 'has correct external_url' do
context 'external_url' do
@@ -184,7 +184,7 @@ describe Sentry::Client::Issue do
it_behaves_like 'calls sentry api'
it_behaves_like 'issues have correct return type', Gitlab::ErrorTracking::Error
- it_behaves_like 'issues have correct length', 1
+ it_behaves_like 'issues have correct length', 2
end
context 'when cursor is present' do
@@ -194,7 +194,7 @@ describe Sentry::Client::Issue do
it_behaves_like 'calls sentry api'
it_behaves_like 'issues have correct return type', Gitlab::ErrorTracking::Error
- it_behaves_like 'issues have correct length', 1
+ it_behaves_like 'issues have correct length', 2
end
end
diff --git a/spec/models/broadcast_message_spec.rb b/spec/models/broadcast_message_spec.rb
index 67d8284bebe..6cef81d6e44 100644
--- a/spec/models/broadcast_message_spec.rb
+++ b/spec/models/broadcast_message_spec.rb
@@ -65,6 +65,17 @@ describe BroadcastMessage do
end
end
+ it 'expires the value if a broadcast message has ended', :request_store do
+ message = create(:broadcast_message, broadcast_type: broadcast_type, ends_at: Time.now.utc + 1.day)
+
+ expect(subject.call).to match_array([message])
+ expect(described_class.cache).to receive(:expire).and_call_original
+
+ Timecop.travel(1.week) do
+ 2.times { expect(subject.call).to be_empty }
+ end
+ end
+
it 'does not create new records' do
create(:broadcast_message, broadcast_type: broadcast_type)
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 00ffc3cae54..a8cdebd2b9c 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -2366,7 +2366,7 @@ describe Repository do
end
end
- describe '#tree' do
+ shared_examples '#tree' do
context 'using a non-existing repository' do
before do
allow(repository).to receive(:head_commit).and_return(nil)
@@ -2384,10 +2384,17 @@ describe Repository do
context 'using an existing repository' do
it 'returns a Tree' do
expect(repository.tree(:head)).to be_an_instance_of(Tree)
+ expect(repository.tree('v1.1.1')).to be_an_instance_of(Tree)
end
end
end
+ it_behaves_like '#tree'
+
+ describe '#tree? with Rugged enabled', :enable_rugged do
+ it_behaves_like '#tree'
+ end
+
describe '#size' do
context 'with a non-existing repository' do
it 'returns 0' do
diff --git a/spec/support_specs/helpers/active_record/query_recorder_spec.rb b/spec/support_specs/helpers/active_record/query_recorder_spec.rb
index 48069c6a766..0827ce37b07 100644
--- a/spec/support_specs/helpers/active_record/query_recorder_spec.rb
+++ b/spec/support_specs/helpers/active_record/query_recorder_spec.rb
@@ -14,9 +14,6 @@ describe ActiveRecord::QueryRecorder do
TestQueries.first
end
- # Test first_only flag works as expected
- expect(control.find_query(/.*query_recorder_spec.rb.*/, 0, first_only: true))
- .to eq(control.find_query(/.*query_recorder_spec.rb.*/, 0).first)
# Check #find_query
expect(control.find_query(/.*/, 0).size)
.to eq(control.data.keys.size)
@@ -32,9 +29,7 @@ describe ActiveRecord::QueryRecorder do
# Ensure memoization value match the raw value above
expect(control.count).to eq(control.log.size)
# Ensure we have only two sources of queries
- expect(control.data.keys.size).to eq(2)
- # Ensure we detect only queries from this file
- expect(control.data.keys.find_all { |i| i.match(/query_recorder_spec.rb/) }.count).to eq(2)
+ expect(control.data.keys.size).to eq(1)
end
end
end
diff --git a/spec/uploaders/import_export_uploader_spec.rb b/spec/uploaders/import_export_uploader_spec.rb
index 7e8937ff5a6..33cab911f86 100644
--- a/spec/uploaders/import_export_uploader_spec.rb
+++ b/spec/uploaders/import_export_uploader_spec.rb
@@ -51,4 +51,10 @@ describe ImportExportUploader do
end
end
end
+
+ describe '.workhorse_local_upload_path' do
+ it 'returns path that includes uploads dir' do
+ expect(described_class.workhorse_local_upload_path).to end_with('/uploads/tmp/uploads')
+ end
+ end
end