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-01-29 03:08:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-29 03:08:58 +0300
commit79216161b305b8d23b34226d45aa92dbae316cfe (patch)
treefbedafc415fcfb9970968ac17e94a443ce7ce477 /spec
parentc1924b863ad66503edbaa3325949bce6b023b737 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/fixtures/api/schemas/variable.json1
-rw-r--r--spec/frontend/environments/emtpy_state_spec.js40
-rw-r--r--spec/javascripts/environments/emtpy_state_spec.js54
-rw-r--r--spec/models/issue_assignee_spec.rb18
-rw-r--r--spec/models/merge_request_assignee_spec.rb18
-rw-r--r--spec/serializers/variable_entity_spec.rb2
-rw-r--r--spec/services/quick_actions/interpret_service_spec.rb2
7 files changed, 79 insertions, 56 deletions
diff --git a/spec/fixtures/api/schemas/variable.json b/spec/fixtures/api/schemas/variable.json
index 305071a6b3f..c49d7d8c5ea 100644
--- a/spec/fixtures/api/schemas/variable.json
+++ b/spec/fixtures/api/schemas/variable.json
@@ -13,6 +13,7 @@
"value": { "type": "string" },
"masked": { "type": "boolean" },
"protected": { "type": "boolean" },
+ "variable_type": { "type": "string" },
"environment_scope": { "type": "string", "optional": true }
},
"additionalProperties": false
diff --git a/spec/frontend/environments/emtpy_state_spec.js b/spec/frontend/environments/emtpy_state_spec.js
new file mode 100644
index 00000000000..ed90c13f1e1
--- /dev/null
+++ b/spec/frontend/environments/emtpy_state_spec.js
@@ -0,0 +1,40 @@
+import { shallowMount } from '@vue/test-utils';
+import EmptyState from '~/environments/components/empty_state.vue';
+
+describe('environments empty state', () => {
+ let vm;
+
+ beforeEach(() => {
+ vm = shallowMount(EmptyState, {
+ propsData: {
+ newPath: 'foo',
+ canCreateEnvironment: true,
+ helpPath: 'bar',
+ },
+ });
+ });
+
+ afterEach(() => {
+ vm.destroy();
+ });
+
+ it('renders the empty state', () => {
+ expect(vm.find('.js-blank-state-title').text()).toEqual(
+ "You don't have any environments right now",
+ );
+ });
+
+ it('renders the new environment button', () => {
+ expect(vm.find('.js-new-environment-button').attributes('href')).toEqual('foo');
+ });
+
+ describe('without permission', () => {
+ beforeEach(() => {
+ vm.setProps({ canCreateEnvironment: false });
+ });
+
+ it('does not render the new environment button', () => {
+ expect(vm.find('.js-new-environment-button').exists()).toBe(false);
+ });
+ });
+});
diff --git a/spec/javascripts/environments/emtpy_state_spec.js b/spec/javascripts/environments/emtpy_state_spec.js
deleted file mode 100644
index eec06a43a1e..00000000000
--- a/spec/javascripts/environments/emtpy_state_spec.js
+++ /dev/null
@@ -1,54 +0,0 @@
-import Vue from 'vue';
-import mountComponent from 'spec/helpers/vue_mount_component_helper';
-import emptyState from '~/environments/components/empty_state.vue';
-
-describe('environments empty state', () => {
- let vm;
- let Component;
-
- beforeEach(() => {
- Component = Vue.extend(emptyState);
- });
-
- afterEach(() => {
- vm.$destroy();
- });
-
- describe('With permissions', () => {
- beforeEach(() => {
- vm = mountComponent(Component, {
- newPath: 'foo',
- canCreateEnvironment: true,
- helpPath: 'bar',
- });
- });
-
- it('renders empty state and new environment button', () => {
- expect(vm.$el.querySelector('.js-blank-state-title').textContent.trim()).toEqual(
- "You don't have any environments right now",
- );
-
- expect(vm.$el.querySelector('.js-new-environment-button').getAttribute('href')).toEqual(
- 'foo',
- );
- });
- });
-
- describe('Without permission', () => {
- beforeEach(() => {
- vm = mountComponent(Component, {
- newPath: 'foo',
- canCreateEnvironment: false,
- helpPath: 'bar',
- });
- });
-
- it('renders empty state without new button', () => {
- expect(vm.$el.querySelector('.js-blank-state-title').textContent.trim()).toEqual(
- "You don't have any environments right now",
- );
-
- expect(vm.$el.querySelector('.js-new-environment-button')).toBeNull();
- });
- });
-});
diff --git a/spec/models/issue_assignee_spec.rb b/spec/models/issue_assignee_spec.rb
new file mode 100644
index 00000000000..2d59ba15101
--- /dev/null
+++ b/spec/models/issue_assignee_spec.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe IssueAssignee do
+ let(:issue) { create(:issue) }
+
+ subject { issue.issue_assignees.build(assignee: create(:user)) }
+
+ describe 'associations' do
+ it { is_expected.to belong_to(:issue).class_name('Issue') }
+ it { is_expected.to belong_to(:assignee).class_name('User') }
+ end
+
+ describe 'validations' do
+ it { is_expected.to validate_uniqueness_of(:assignee).scoped_to(:issue_id) }
+ end
+end
diff --git a/spec/models/merge_request_assignee_spec.rb b/spec/models/merge_request_assignee_spec.rb
new file mode 100644
index 00000000000..d6aab15d990
--- /dev/null
+++ b/spec/models/merge_request_assignee_spec.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe MergeRequestAssignee do
+ let(:merge_request) { create(:merge_request) }
+
+ subject { merge_request.merge_request_assignees.build(assignee: create(:user)) }
+
+ describe 'associations' do
+ it { is_expected.to belong_to(:merge_request).class_name('MergeRequest') }
+ it { is_expected.to belong_to(:assignee).class_name('User') }
+ end
+
+ describe 'validations' do
+ it { is_expected.to validate_uniqueness_of(:assignee).scoped_to(:merge_request_id) }
+ end
+end
diff --git a/spec/serializers/variable_entity_spec.rb b/spec/serializers/variable_entity_spec.rb
index 742b14fb3d3..3cb18dab314 100644
--- a/spec/serializers/variable_entity_spec.rb
+++ b/spec/serializers/variable_entity_spec.rb
@@ -10,7 +10,7 @@ describe VariableEntity do
subject { entity.as_json }
it 'contains required fields' do
- expect(subject).to include(:id, :key, :value, :protected, :environment_scope)
+ expect(subject).to include(:id, :key, :value, :protected, :environment_scope, :variable_type)
end
end
end
diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb
index c56c23ffc70..81012eba06d 100644
--- a/spec/services/quick_actions/interpret_service_spec.rb
+++ b/spec/services/quick_actions/interpret_service_spec.rb
@@ -804,7 +804,7 @@ describe QuickActions::InterpretService do
let(:issuable) { issue }
end
- it_behaves_like 'empty command' do
+ it_behaves_like 'empty command', "Failed to assign a user because no user was found." do
let(:content) { '/assign' }
let(:issuable) { issue }
end