Commit 749ebc1c authored by Yorick Peterse's avatar Yorick Peterse

Reinstate changes lost due to automatic merging

The automatic merging code used `--strategy=ours`, which turned out to
be incorrect; instead we wanted `--strategy=recursive
--strategy-option=ours`. This small difference results in merging
throwing away _all_ EE changes in favour of CE changes, instead of only
doing this for conflicts.

This commit ensures that EE has all the appropriate changes. The diff
was generated by cherry picking all merge commits made since two days
ago, picking them with `--strategy=recursive --strategy-option=ours`.
parent b93f926b
......@@ -814,7 +814,7 @@ gitlab:setup-mysql:
# Frontend-related jobs
gitlab:assets:compile:
<<: *dedicated-no-docs-and-no-qa-pull-cache-job
image: dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.5.3-git-2.18-chrome-69.0-node-8.x-yarn-1.2-graphicsmagick-1.3.29-docker-18.06.1
image: dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.5.3-git-2.18-chrome-69.0-node-8.x-yarn-1.12-graphicsmagick-1.3.29-docker-18.06.1
dependencies: []
services:
- docker:stable-dind
......
......@@ -107,12 +107,6 @@ Lint/UriEscapeUnescape:
Metrics/LineLength:
Max: 1310
# Offense count: 2
Naming/ConstantName:
Exclude:
- 'lib/gitlab/import_sources.rb'
- 'lib/gitlab/ssh_public_key.rb'
# Offense count: 11
# Configuration parameters: EnforcedStyle.
# SupportedStyles: lowercase, uppercase
......
......@@ -287,6 +287,7 @@ gem 'webpack-rails', '~> 0.9.10'
gem 'rack-proxy', '~> 0.6.0'
gem 'sass-rails', '~> 5.0.6'
gem 'sass', '~> 3.5'
gem 'uglifier', '~> 2.7.2'
gem 'addressable', '~> 2.5.2'
......
......@@ -1166,6 +1166,7 @@ DEPENDENCIES
rufus-scheduler (~> 3.4)
rugged (~> 0.27)
sanitize (~> 4.6)
sass (~> 3.5)
sass-rails (~> 5.0.6)
scss_lint (~> 0.56.0)
seed-fu (~> 2.3.7)
......
......@@ -1156,6 +1156,7 @@ DEPENDENCIES
rufus-scheduler (~> 3.4)
rugged (~> 0.27)
sanitize (~> 4.6)
sass (~> 3.5)
sass-rails (~> 5.0.6)
scss_lint (~> 0.56.0)
seed-fu (~> 2.3.7)
......
......@@ -27,7 +27,7 @@ export default {
apollo: {
issues: {
query,
debounce: 250,
debounce: 1000,
skip() {
return this.isSearchEmpty;
},
......
......@@ -102,7 +102,7 @@ export default {
if (parentElement && parentElement.classList.contains('js-vue-notes-event')) {
parentElement.addEventListener('toggleAward', event => {
const { awardName, noteId } = event.detail;
this.actionToggleAward({ awardName, noteId });
this.toggleAward({ awardName, noteId });
});
}
},
......
<script>
import $ from 'jquery';
import { s__ } from '~/locale';
import { __ } from '~/locale';
import Flash from '../../../flash';
import GLForm from '../../../gl_form';
import markdownHeader from './header.vue';
......@@ -99,11 +99,12 @@ export default {
if (text) {
this.markdownPreviewLoading = true;
this.markdownPreview = __('Loading…');
this.$http
.post(this.versionedPreviewPath(), { text })
.then(resp => resp.json())
.then(data => this.renderMarkdown(data))
.catch(() => new Flash(s__('Error loading markdown preview')));
.catch(() => new Flash(__('Error loading markdown preview')));
} else {
this.renderMarkdown();
}
......@@ -162,10 +163,12 @@ export default {
/>
</div>
</div>
<div v-show="previewMarkdown" class="md md-preview-holder md-preview js-vue-md-preview">
<div ref="markdown-preview" v-html="markdownPreview"></div>
<span v-if="markdownPreviewLoading"> Loading... </span>
</div>
<div
v-show="previewMarkdown"
ref="markdown-preview"
class="md-preview js-vue-md-preview md md-preview-holder"
v-html="markdownPreview"
></div>
<template v-if="previewMarkdown && !markdownPreviewLoading">
<div v-if="referencedCommands" class="referenced-commands" v-html="referencedCommands"></div>
<div v-if="shouldShowReferencedUsers" class="referenced-users">
......
......@@ -290,6 +290,10 @@
}
}
.dropdown-item {
@include dropdown-link;
}
.divider {
height: 1px;
margin: #{$grid-size / 2} 0;
......
......@@ -126,6 +126,8 @@ module IssuableCollections
sort_param = params[:sort]
sort_param ||= user_preference[issuable_sorting_field]
return sort_param if Gitlab::Database.read_only?
if user_preference[issuable_sorting_field] != sort_param
user_preference.update_attribute(issuable_sorting_field, sort_param)
end
......
# frozen_string_literal: true
module Ci
class Bridge < CommitStatus
include Importable
include AfterCommitQueue
include Gitlab::Utils::StrongMemoize
belongs_to :project
validates :ref, presence: true
def self.retry(bridge, current_user)
raise NotImplementedError
end
def tags
[:bridge]
end
def detailed_status(current_user)
Gitlab::Ci::Status::Bridge::Factory
.new(self, current_user)
.fabricate!
end
def predefined_variables
raise NotImplementedError
end
def execute_hooks
raise NotImplementedError
end
end
end
......@@ -749,15 +749,9 @@ class Project < ActiveRecord::Base
return if data.nil? && credentials.nil?
project_import_data = import_data || build_import_data
if data
project_import_data.data ||= {}
project_import_data.data = project_import_data.data.merge(data)
end
if credentials
project_import_data.credentials ||= {}
project_import_data.credentials = project_import_data.credentials.merge(credentials)
end
project_import_data.merge_data(data.to_h)
project_import_data.merge_credentials(credentials.to_h)
project_import_data
end
......@@ -2014,12 +2008,12 @@ class Project < ActiveRecord::Base
def create_new_pool_repository
pool = begin
create_or_find_pool_repository!(shard: Shard.by_name(repository_storage), source_project: self)
create_pool_repository!(shard: Shard.by_name(repository_storage), source_project: self)
rescue ActiveRecord::RecordNotUnique
retry
pool_repository(true)
end
pool.schedule
pool.schedule unless pool.scheduled?
pool
end
......
......@@ -24,4 +24,12 @@ class ProjectImportData < ActiveRecord::Base
# bang doesn't work here - attr_encrypted makes it not to work
self.credentials = self.credentials.deep_symbolize_keys unless self.credentials.blank?
end
def merge_data(hash)
self.data = data.to_h.merge(hash) unless hash.empty?
end
def merge_credentials(hash)
self.credentials = credentials.to_h.merge(hash) unless hash.empty?
end
end
......@@ -28,7 +28,7 @@
= link_to project_tree_path(@project, @commit), class: "btn btn-default append-right-10 d-none d-sm-none d-md-inline" do
#{ _('Browse files') }
.dropdown.inline
%a.btn.btn-default.dropdown-toggle{ data: { toggle: "dropdown" } }
%a.btn.btn-default.dropdown-toggle.qa-options-button{ data: { toggle: "dropdown" } }
%span= _('Options')
= icon('caret-down')
%ul.dropdown-menu.dropdown-menu-right
......@@ -48,8 +48,8 @@
%li.dropdown-header
#{ _('Download') }
- unless @commit.parents.length > 1
%li= link_to s_("DownloadCommit|Email Patches"), project_commit_path(@project, @commit, format: :patch)
%li= link_to s_("DownloadCommit|Plain Diff"), project_commit_path(@project, @commit, format: :diff)
%li= link_to s_("DownloadCommit|Email Patches"), project_commit_path(@project, @commit, format: :patch), class: "qa-email-patches"
%li= link_to s_("DownloadCommit|Plain Diff"), project_commit_path(@project, @commit, format: :diff), class: "qa-plain-diff"
.commit-box{ data: { project_path: project_path(@project) } }
%h3.commit-title
......
---
title: Update GitLab Workhorse to v8.0.0
merge_request: 23740
author:
type: other
---
title: Remove unnecessary div from MarkdownField to apply list styles correctly
merge_request: 23733
author:
type: fixed
......@@ -228,6 +228,7 @@ stages:
- package
run_tests:
stage: test
script:
- make test
......
......@@ -55,27 +55,27 @@ A job is defined by a list of parameters that define the job behavior.
| Keyword | Required | Description |
|---------------|----------|-------------|
| script | yes | Defines a shell script which is executed by Runner |
| extends | no | Defines a configuration entry that this job is going to inherit from |
| image | no | Use docker image, covered in [Using Docker Images](../docker/using_docker_images.md#define-image-and-services-from-gitlab-ciyml) |
| services | no | Use docker services, covered in [Using Docker Images](../docker/using_docker_images.md#define-image-and-services-from-gitlab-ciyml) |
| stage | no | Defines a job stage (default: `test`) |
| type | no | Alias for `stage` |
| variables | no | Define job variables on a job level |
| only | no | Defines a list of git refs for which job is created |
| except | no | Defines a list of git refs for which job is not created |
| tags | no | Defines a list of tags which are used to select Runner |
| allow_failure | no | Allow job to fail. Failed job doesn't contribute to commit status |
| when | no | Define when to run job. Can be `on_success`, `on_failure`, `always` or `manual` |
| dependencies | no | Define other jobs that a job depends on so that you can pass artifacts between them|
| artifacts | no | Define list of [job artifacts](#artifacts) |
| cache | no | Define list of files that should be cached between subsequent runs |
| before_script | no | Override a set of commands that are executed before job |
| after_script | no | Override a set of commands that are executed after job |
| environment | no | Defines a name of environment to which deployment is done by this job |
| coverage | no | Define code coverage settings for a given job |
| retry | no | Define when and how many times a job can be auto-retried in case of a failure |
| parallel | no | Defines how many instances of a job should be run in parallel |
| [script](#script) | yes | Defines a shell script which is executed by Runner |
| [extends](#extends) | no | Defines a configuration entry that this job is going to inherit from |
| [image](#image-and-services) | no | Use docker image, covered in [Using Docker Images](../docker/using_docker_images.md#define-image-and-services-from-gitlab-ciyml) |
| [services](#image-and-services) | no | Use docker services, covered in [Using Docker Images](../docker/using_docker_images.md#define-image-and-services-from-gitlab-ciyml) |
| [stage](#stage) | no | Defines a job stage (default: `test`) |
| type | no | Alias for `stage` |
| [variables](#variables) | no | Define job variables on a job level |
| [only](#only-and-except-simplified) | no | Defines a list of git refs for which job is created |
| [except](#only-and-except-simplified) | no | Defines a list of git refs for which job is not created |
| [tags](#tags) | no | Defines a list of tags which are used to select Runner |
| [allow_failure](#allow_failure) | no | Allow job to fail. Failed job doesn't contribute to commit status |
| [when](#when) | no | Define when to run job. Can be `on_success`, `on_failure`, `always` or `manual` |
| [dependencies](#dependencies) | no | Define other jobs that a job depends on so that you can pass artifacts between them|
| [artifacts](#artifacts) | no | Define list of [job artifacts](#artifacts) |
| [cache](#cache) | no | Define list of files that should be cached between subsequent runs |
| [before_script](#before_script-and-after_script) | no | Override a set of commands that are executed before job |
| [after_script](#before_script-and-after_script) | no | Override a set of commands that are executed after job |
| [environment](#environment) | no | Defines a name of environment to which deployment is done by this job |
| [coverage](#coverage) | no | Define code coverage settings for a given job |
| [retry](#retry) | no | Define when and how many times a job can be auto-retried in case of a failure |
| [parallel](#parallel) | no | Defines how many instances of a job should be run in parallel |
### `extends`
......
This diff is collapsed.
......@@ -10,7 +10,7 @@ code is effective, understandable, maintainable, and secure.
## Getting your merge request reviewed, approved, and merged
You are strongly encouraged to get your code **reviewed** by a
[reviewer](https://about.gitlab.com/handbook/engineering/#reviewer) as soon as
[reviewer](https://about.gitlab.com/handbook/engineering/workflow/code-review/#reviewer) as soon as
there is any code to review, to get a second opinion on the chosen solution and
implementation, and an extra pair of eyes looking for bugs, logic problems, or
uncovered edge cases. The reviewer can be from a different team, but it is
......@@ -24,7 +24,7 @@ If you need assistance with security scans or comments, feel free to include the
Security Team (`@gitlab-com/gl-security`) in the review.
Depending on the areas your merge request touches, it must be **approved** by one
or more [maintainers](https://about.gitlab.com/handbook/engineering/#maintainer):
or more [maintainers](https://about.gitlab.com/handbook/engineering/workflow/code-review/#maintainer):
For approvals, we use the approval functionality found in the merge request
widget. Reviewers can add their approval by [approving additionally](https://docs.gitlab.com/ee/user/project/merge_requests/merge_request_approvals.html#adding-or-removing-an-approval).
......
......@@ -137,6 +137,7 @@ By following this pattern we guarantee:
#### Dispatching actions
To dispatch an action from a component, use the `mapActions` helper:
```javascript
import { mapActions } from 'vuex';
......@@ -204,6 +205,7 @@ export const getUsersWithPets = (state, getters) => {
```
To access a getter from a component, use the `mapGetters` helper:
```javascript
import { mapGetters } from 'vuex';
......@@ -226,6 +228,7 @@ export const ADD_USER = 'ADD_USER';
### How to include the store in your application
The store should be included in the main component of your application:
```javascript
// app.vue
import store from 'store'; // it will include the index.js file
......@@ -364,7 +367,8 @@ Because we're currently using [`babel-plugin-rewire`](https://github.com/speedsk
`[vuex] actions should be function or object with "handler" function`
To prevent this error from happening, you need to export an empty function as `default`:
```
```javascript
// getters.js or actions.js
// prevent babel-plugin-rewire from generating an invalid default during karma tests
......
......@@ -8,6 +8,7 @@ If you're not sure if Kubernetes is for you, our
[Omnibus GitLab packages](../README.md#install-gitlab-using-the-omnibus-gitlab-package-recommended)
are mature, scalable, support [high availability](../../administration/high_availability/README.md)
and are used today on GitLab.com.
It is not necessary to have GitLab installed on Kubernetes in order to use [GitLab Kubernetes integration](https://docs.gitlab.com/ee/user/project/clusters/index.html).
## Introduction
......
......@@ -10,6 +10,7 @@ If you're not sure if Kubernetes is for you, our
[Omnibus GitLab packages](../README.md#install-gitlab-using-the-omnibus-gitlab-package-recommended)
are mature, scalable, support [high availability](../../administration/high_availability/README.md)
and are used today on GitLab.com.
It is not necessary to have GitLab installed on Kubernetes in order to use [GitLab Kubernetes integration](https://docs.gitlab.com/ee/user/project/clusters/index.html).
The easiest method to deploy GitLab on [Kubernetes](https://kubernetes.io/) is
to take advantage of GitLab's Helm charts. [Helm](https://github.com/kubernetes/helm/blob/master/README.md)
......
......@@ -9,9 +9,9 @@ to confirm that a real user, not a bot, is attempting to create an account.
To use reCAPTCHA, first you must create a site and private key.
1. Go to the URL: <https://www.google.com/recaptcha/admin>.
1. Fill out the form necessary to obtain reCAPTCHA keys.
1. Login to your GitLab server, with administrator credentials.
1. Go to Applications Settings on Admin Area (`admin/application_settings`).
1. Fill out the form necessary to obtain reCAPTCHA v2 keys.
1. Log in to your GitLab server, with administrator credentials.
1. Go to Reporting Applications Settings in the Admin Area (`admin/application_settings/reporting`).
1. Fill all recaptcha fields with keys from previous steps.
1. Check the `Enable reCAPTCHA` checkbox.
1. Save the configuration.
......
......@@ -10,8 +10,7 @@ Rack Attack offers IP whitelisting, blacklisting, Fail2ban style filtering and
tracking.
**Note:** Starting with 11.2, Rack Attack is disabled by default. To continue
using this feature, please enable it in your `gitlab.rb` by setting
`gitlab_rails['rack_attack_git_basic_auth'] = true`.
using this feature, please enable it by [configuring `gitlab.rb` as described in Settings](#settings).
By default, user sign-in, user sign-up (if enabled), and user password reset is
limited to 6 requests per minute. After trying for 6 times, the client will
......
......@@ -24,6 +24,10 @@
> Otherwise, a supplementary comment is left to mention the original author and
> the MRs, notes or issues will be owned by the importer.
> - Control project Import/Export with the [API](../../../api/project_import_export.md).
> - If an imported project contains merge requests originated from forks,
> then new branches associated with such merge requests will be created
> within a project during the import/export. Thus, the number of branches
> in the exported project could be bigger than in the original project.
Existing projects running on any GitLab instance or GitLab.com can be exported
with all their related data and be moved into a new GitLab instance.
......
......@@ -14,6 +14,7 @@ if (process.env.CI) {
// eslint-disable-next-line import/no-commonjs
module.exports = {
testMatch: ['<rootDir>/spec/frontend/**/*_spec.js'],
moduleFileExtensions: ['js', 'json', 'vue'],
moduleNameMapper: {
'^~(.*)$': '<rootDir>/app/assets/javascripts$1',
'^helpers(.*)$': '<rootDir>/spec/frontend/helpers$1',
......@@ -26,4 +27,8 @@ module.exports = {
reporters,
setupTestFrameworkScriptFile: '<rootDir>/spec/frontend/test_setup.js',
restoreMocks: true,
transform: {
'^.+\\.js$': 'babel-jest',
'^.+\\.vue$': 'vue-jest',
},
};
# frozen_string_literal: true
module Gitlab
module Ci
module Status
module Bridge
module Common
def label
subject.description
end
def has_details?
false
end
def has_action?
false
end
def details_path
raise NotImplementedError
end
end
end
end
end
end
# frozen_string_literal: true
module Gitlab
module Ci
module Status
module Bridge
class Factory < Status::Factory
def self.common_helpers
Status::Bridge::Common
end
end
end
end
end
end
......@@ -10,7 +10,7 @@ module Gitlab
ImportSource = Struct.new(:name, :title, :importer)
# We exclude `bare_repository` here as it has no import class associated
ImportTable = [
IMPORT_TABLE = [
ImportSource.new('github', 'GitHub', Gitlab::GithubImport::ParallelImporter),
ImportSource.new('bitbucket', 'Bitbucket Cloud', Gitlab::BitbucketImport::Importer),
ImportSource.new('bitbucket_server', 'Bitbucket Server', Gitlab::BitbucketServerImport::Importer),
......@@ -47,7 +47,7 @@ module Gitlab
end
def import_table
ImportTable
IMPORT_TABLE
end
end
end
......
......@@ -4,7 +4,7 @@ module Gitlab
class SSHPublicKey
Technology = Struct.new(:name, :key_class, :supported_sizes)
Technologies = [
TECHNOLOGIES = [
Technology.new(:rsa, OpenSSL::PKey::RSA, [1024, 2048, 3072, 4096]),
Technology.new(:dsa, OpenSSL::PKey::DSA, [1024, 2048, 3072]),
Technology.new(:ecdsa, OpenSSL::PKey::EC, [256, 384, 521]),
......@@ -12,11 +12,11 @@ module Gitlab
].freeze
def self.technology(name)
Technologies.find { |tech| tech.name.to_s == name.to_s }
TECHNOLOGIES.find { |tech| tech.name.to_s == name.to_s }
end
def self.technology_for_key(key)
Technologies.find { |tech| key.is_a?(tech.key_class) }
TECHNOLOGIES.find { |tech| key.is_a?(tech.key_class) }
end
def self.supported_sizes(name)
......
......@@ -31,7 +31,6 @@ module Gitlab
GL_USERNAME: user&.username,
ShowAllRefs: show_all_refs,
Repository: repository.gitaly_repository.to_h,
RepoPath: 'ignored but not allowed to be empty in gitlab-workhorse',
GitConfigOptions: [],
GitalyServer: {
address: Gitlab::GitalyClient.address(project.repository_storage),
......
......@@ -5165,6 +5165,9 @@ msgstr ""
msgid "Loading..."
msgstr ""
msgid "Loading…"
msgstr ""
msgid "Lock"
msgstr ""
......
......@@ -159,6 +159,10 @@
"karma-webpack": "^4.0.0-beta.0",
"nodemon": "^1.18.4",
"prettier": "1.15.2",
"vue-jest": "^3.0.1",
"webpack-dev-server": "^3.1.10"
},
"engines": {
"yarn": "^1.10.0"
}
}
......@@ -158,6 +158,10 @@ module QA
autoload :Activity, 'qa/page/project/activity'
autoload :Menu, 'qa/page/project/menu'
module Commit
autoload :Show, 'qa/page/project/commit/show'
end
module Import
autoload :Github, 'qa/page/project/import/github'
end
......
# frozen_string_literal: true
module QA
module Page
module Project
module Commit
class Show < Page::Base
view 'app/views/projects/commit/_commit_box.html.haml' do
element :options_button
element :email_patches
element :plain_diff
end
def select_email_patches
click_element :options_button
click_element :email_patches
end
def select_plain_diff
click_element :options_button
click_element :plain_diff
end
end
end
end
end
end
......@@ -74,9 +74,14 @@ module QA
end
end
def go_to_commit(commit_msg)
within_element(:file_tree) do
click_on commit_msg
end
end
def go_to_new_issue
click_element :new_menu_toggle
click_link 'New issue'
end
......
......@@ -58,7 +58,10 @@ module QA
populate(:target, :source)
project.visit!
Page::Project::Show.perform(&:new_merge_request)
Page::Project::Show.perform do |project|
project.wait_for_push
project.new_merge_request
end
Page::MergeRequest::New.perform do |page|
page.fill_title(@title)
page.fill_description(@description)
......
# frozen_string_literal: true
module QA
context 'Create' do
describe 'Commit data' do
before(:context) do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
@project = Resource::Repository::ProjectPush.fabricate! do |push|
push.file_name = 'README.md'
push.file_content = '# This is a test project'
push.commit_message = 'Add README.md'
end
# first file added has no parent commit, thus no diff data
# add second file to repo to enable diff from initial commit
@commit_message = 'Add second file'
@project.visit!
Page::Project::Show.perform(&:create_new_file!)
Page::File::Form.perform do |f|
f.add_name('second')
f.add_content('second file content')
f.add_commit_message(@commit_message)
f.commit_changes
end
end
def view_commit
@project.visit!
Page::Project::Show.perform do |page|
page.go_to_commit(@commit_message)
end
end
def raw_content
find('pre').text
end
it 'user views raw email patch' do
view_commit
Page::Project::Commit::Show.perform(&:select_email_patches)
expect(page).to have_content('From: Administrator <admin@example.com>')
expect(page).to have_content('Subject: [PATCH] Add second file')
expect(page).to have_content('diff --git a/second b/second')
end
it 'user views raw commit diff' do
view_commit
Page::Project::Commit::Show.perform(&:select_plain_diff)
expect(raw_content).to start_with('diff --git a/second b/second')
expect(page).to have_content('+second file content')
end
end
end
end
......@@ -42,6 +42,8 @@ describe Projects::IssuesController do
it_behaves_like "issuables list meta-data", :issue
it_behaves_like 'set sort order from user preference'
it "returns index" do
get :index, namespace_id: project.namespace, project_id: project
......
......@@ -160,6 +160,8 @@ describe Projects::MergeRequestsController do
it_behaves_like "issuables list meta-data", :merge_request
it_behaves_like 'set sort order from user preference'
context 'when page param' do
let(:last_page) { project.merge_requests.page().total_pages }
let!(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
......
FactoryBot.define do
factory :ci_bridge, class: Ci::Bridge do
name ' bridge'
stage 'test'
stage_idx 0
ref 'master'
tag false
created_at 'Di 29. Okt 09:50:00 CET 2013'
status :success
pipeline factory: :ci_pipeline
after(:build) do |bridge, evaluator|
bridge.project ||= bridge.pipeline.project
end
end
end
......@@ -4,11 +4,14 @@ describe 'Merge request > User awards emoji', :js do
let(:project) { create(:project, :public, :repository) }
let(:user) { project.creator }
let(:merge_request) { create(:merge_request, source_project: project, author: create(:user)) }
let!(:note) { create(:note, noteable: merge_request, project: merge_request.project) }
describe 'logged in' do
before do
sign_in(user)
visit project_merge_request_path(project, merge_request)
wait_for_requests
end
it 'adds award to merge request' do
......@@ -36,6 +39,15 @@ describe 'Merge request > User awards emoji', :js do
expect(page).to have_selector('.emoji-menu', count: 1)
end
it 'adds awards to note' do
first('.js-note-emoji').click
first('.emoji-menu .js-emoji-btn').click
wait_for_requests
expect(page).to have_selector('.js-awards-block')
end
describe 'the project is archived' do
let(:project) { create(:project, :public, :repository, :archived) }
......
it('does nothing', () => {});
......@@ -30,6 +30,8 @@ describe('note_app', () => {
jasmine.addMatchers(vueMatchers);
$('body').attr('data-page', 'projects:merge_requests:show');
setFixtures('<div class="js-vue-notes-event"><div id="app"></div></div>');
const IssueNotesApp = Vue.extend(notesApp);
store = createStore();
......@@ -43,6 +45,7 @@ describe('note_app', () => {
return mountComponentWithStore(IssueNotesApp, {
props,
store,
el: document.getElementById('app'),
});
};
});
......@@ -283,4 +286,24 @@ describe('note_app', () => {
}, 0);
});
});
describe('emoji awards', () => {
it('dispatches toggleAward after toggleAward event', () => {
const toggleAwardEvent = new CustomEvent('toggleAward', {
detail: {
awardName: 'test',
noteId: 1,
},
});
spyOn(vm.$store, 'dispatch');
vm.$el.parentElement.dispatchEvent(toggleAwardEvent);
expect(vm.$store.dispatch).toHaveBeenCalledWith('toggleAward', {
awardName: 'test',
noteId: 1,
});
});
});
});
......@@ -80,7 +80,7 @@ describe('Markdown field component', () => {
previewLink.click();
Vue.nextTick(() => {
expect(vm.$el.querySelector('.md-preview').textContent.trim()).toContain('Loading...');
expect(vm.$el.querySelector('.md-preview').textContent.trim()).toContain('Loading');
done();
});
......
......@@ -246,7 +246,6 @@ describe Gitlab::Workhorse do
GL_ID: "user-#{user.id}",
GL_USERNAME: user.username,
GL_REPOSITORY: "project-#{project.id}",
RepoPath: repo_path,
ShowAllRefs: false
}
end
......@@ -261,7 +260,6 @@ describe Gitlab::Workhorse do
GL_ID: "user-#{user.id}",
GL_USERNAME: user.username,
GL_REPOSITORY: "wiki-#{project.id}",
RepoPath: repo_path,
ShowAllRefs: false
}
end
......
require 'spec_helper'
describe Ci::Bridge do
set(:project) { create(:project) }
set(:pipeline) { create(:ci_pipeline, project: project) }
let(:bridge) do
create(:ci_bridge, pipeline: pipeline)
end
describe '#tags' do
it 'only has a bridge tag' do
expect(bridge.tags).to eq [:bridge]
end
end
describe '#detailed_status' do
let(:user) { create(:user) }
let(:status) { bridge.detailed_status(user) }
it 'returns detailed status object' do
expect(status).to be_a Gitlab::Ci::Status::Success
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe ProjectImportData do
describe '#merge_data' do
it 'writes the Hash to the attribute if it is nil' do
row = described_class.new
row.merge_data('number' => 10)
expect(row.data).to eq({ 'number' => 10 })
end
it 'merges the Hash into an existing Hash if one was present' do
row = described_class.new(data: { 'number' => 10 })
row.merge_data('foo' => 'bar')
expect(row.data).to eq({ 'number' => 10, 'foo' => 'bar' })
end
end
describe '#merge_credentials' do
it 'writes the Hash to the attribute if it is nil' do
row = described_class.new
row.merge_credentials('number' => 10)
expect(row.credentials).to eq({ 'number' => 10 })
end
it 'merges the Hash into an existing Hash if one was present' do
row = described_class.new
row.credentials = { 'number' => 10 }
row.merge_credentials('foo' => 'bar')
expect(row.credentials).to eq({ 'number' => 10, 'foo' => 'bar' })
end
end
end
......@@ -4406,6 +4406,29 @@ describe Project do
end
end
describe '#object_pool_params' do
let(:project) { create(:project, :repository, :public) }
subject { project.object_pool_params }
before do
stub_application_setting(hashed_storage_enabled: true)
end
context 'when the objects cannot be pooled' do
let(:project) { create(:project, :repository, :private) }
it { is_expected.to be_empty }
end
context 'when a pool is created' do
it 'returns that pool repository' do
expect(subject).not_to be_empty
expect(subject[:pool_repository]).to be_persisted
end
end
end
describe '#git_objects_poolable?' do
subject { project }
......
shared_examples 'set sort order from user preference' do
describe '#set_sort_order_from_user_preference' do
# There is no issuable_sorting_field defined in any CE controllers yet,
# however any other field present in user_preferences table can be used for testing.
let(:sorting_field) { :issue_notes_filter }
let(:sorting_param) { 'any' }
before do
allow(controller).to receive(:issuable_sorting_field).and_return(sorting_field)
end
context 'when database is in read-only mode' do
it 'it does not update user preference' do
allow(Gitlab::Database).to receive(:read_only?).and_return(true)
expect_any_instance_of(UserPreference).not_to receive(:update_attribute).with(sorting_field, sorting_param)
get :index, namespace_id: project.namespace, project_id: project, sort: sorting_param
end
end
context 'when database is not in read-only mode' do
it 'updates user preference' do
allow(Gitlab::Database).to receive(:read_only?).and_return(false)
expect_any_instance_of(UserPreference).to receive(:update_attribute).with(sorting_field, sorting_param)
get :index, namespace_id: project.namespace, project_id: project, sort: sorting_param
end
end
end
end
This diff is collapsed.
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