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
diff options
context:
space:
mode:
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/analytics_summary_serializer_spec.rb2
-rw-r--r--spec/serializers/merge_request_user_entity_spec.rb9
-rw-r--r--spec/serializers/merge_request_widget_entity_spec.rb33
-rw-r--r--spec/serializers/service_field_entity_spec.rb14
4 files changed, 21 insertions, 37 deletions
diff --git a/spec/serializers/analytics_summary_serializer_spec.rb b/spec/serializers/analytics_summary_serializer_spec.rb
index 9429c9d571a..6563b58c334 100644
--- a/spec/serializers/analytics_summary_serializer_spec.rb
+++ b/spec/serializers/analytics_summary_serializer_spec.rb
@@ -36,7 +36,7 @@ RSpec.describe AnalyticsSummarySerializer do
context 'when representing with unit' do
let(:resource) do
Gitlab::CycleAnalytics::Summary::DeploymentFrequency
- .new(deployments: 10, options: { from: 1.day.ago })
+ .new(deployments: 10, options: { from: 1.day.ago }, project: project)
end
subject { described_class.new.represent(resource, with_unit: true) }
diff --git a/spec/serializers/merge_request_user_entity_spec.rb b/spec/serializers/merge_request_user_entity_spec.rb
index 026a229322e..72d1b0c0dd2 100644
--- a/spec/serializers/merge_request_user_entity_spec.rb
+++ b/spec/serializers/merge_request_user_entity_spec.rb
@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe MergeRequestUserEntity do
let_it_be(:user) { create(:user) }
- let_it_be(:merge_request) { create(:merge_request) }
+ let_it_be(:merge_request) { create(:merge_request, assignees: [user]) }
let(:request) { EntityRequest.new(project: merge_request.target_project, current_user: user) }
@@ -18,7 +18,8 @@ RSpec.describe MergeRequestUserEntity do
it 'exposes needed attributes' do
is_expected.to include(
:id, :name, :username, :state, :avatar_url, :web_url,
- :can_merge, :can_update_merge_request, :reviewed, :approved
+ :can_merge, :can_update_merge_request, :reviewed, :approved,
+ :attention_requested
)
end
@@ -56,6 +57,10 @@ RSpec.describe MergeRequestUserEntity do
end
end
+ context 'attention_requested' do
+ it { is_expected.to include(attention_requested: true ) }
+ end
+
describe 'performance' do
let_it_be(:user_a) { create(:user) }
let_it_be(:user_b) { create(:user) }
diff --git a/spec/serializers/merge_request_widget_entity_spec.rb b/spec/serializers/merge_request_widget_entity_spec.rb
index fcfdbfc0967..3e0c61a26c0 100644
--- a/spec/serializers/merge_request_widget_entity_spec.rb
+++ b/spec/serializers/merge_request_widget_entity_spec.rb
@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe MergeRequestWidgetEntity do
include ProjectForksHelper
+ include Gitlab::Routing.url_helpers
let(:project) { create :project, :repository }
let(:resource) { create(:merge_request, source_project: project, target_project: project) }
@@ -140,17 +141,15 @@ RSpec.describe MergeRequestWidgetEntity do
let(:role) { :developer }
it 'has add ci config path' do
- expected_path = "/#{resource.project.full_path}/-/new/#{resource.source_branch}"
+ expected_path = project_ci_pipeline_editor_path(project)
expect(subject[:merge_request_add_ci_config_path]).to include(expected_path)
end
it 'has expected params' do
expected_params = {
- commit_message: 'Add .gitlab-ci.yml',
- file_name: '.gitlab-ci.yml',
- suggest_gitlab_ci_yml: 'true',
- mr_path: "/#{resource.project.full_path}/-/merge_requests/#{resource.iid}"
+ branch_name: resource.source_branch,
+ add_new_config_file: 'true'
}.with_indifferent_access
uri = Addressable::URI.parse(subject[:merge_request_add_ci_config_path])
@@ -188,30 +187,6 @@ RSpec.describe MergeRequestWidgetEntity do
end
end
- context 'when ci_config_path is customized' do
- it 'has no path if ci_config_path is not set to our default setting' do
- project.ci_config_path = 'not_default'
-
- expect(subject[:merge_request_add_ci_config_path]).to be_nil
- end
-
- it 'has a path if ci_config_path unset' do
- expect(subject[:merge_request_add_ci_config_path]).not_to be_nil
- end
-
- it 'has a path if ci_config_path is an empty string' do
- project.ci_config_path = ''
-
- expect(subject[:merge_request_add_ci_config_path]).not_to be_nil
- end
-
- it 'has a path if ci_config_path is set to our default file' do
- project.ci_config_path = Gitlab::FileDetector::PATTERNS[:gitlab_ci]
-
- expect(subject[:merge_request_add_ci_config_path]).not_to be_nil
- end
- end
-
context 'when build feature is disabled' do
before do
project.project_feature.update!(builds_access_level: ProjectFeature::DISABLED)
diff --git a/spec/serializers/service_field_entity_spec.rb b/spec/serializers/service_field_entity_spec.rb
index 6e9ebfb66d9..a06fdf95159 100644
--- a/spec/serializers/service_field_entity_spec.rb
+++ b/spec/serializers/service_field_entity_spec.rb
@@ -27,7 +27,8 @@ RSpec.describe ServiceFieldEntity do
help: 'Use a username for server version and an email for cloud version.',
required: true,
choices: nil,
- value: 'jira_username'
+ value: 'jira_username',
+ checkbox_label: nil
}
is_expected.to eq(expected_hash)
@@ -46,7 +47,8 @@ RSpec.describe ServiceFieldEntity do
help: 'Leave blank to use your current password or API token.',
required: true,
choices: nil,
- value: 'true'
+ value: 'true',
+ checkbox_label: nil
}
is_expected.to eq(expected_hash)
@@ -68,7 +70,8 @@ RSpec.describe ServiceFieldEntity do
placeholder: nil,
required: nil,
choices: nil,
- value: 'true'
+ value: 'true',
+ checkbox_label: nil
}
is_expected.to include(expected_hash)
@@ -83,12 +86,13 @@ RSpec.describe ServiceFieldEntity do
expected_hash = {
type: 'select',
name: 'branches_to_be_notified',
- title: nil,
+ title: 'Branches for which notifications are to be sent',
placeholder: nil,
required: nil,
choices: [['All branches', 'all'], ['Default branch', 'default'], ['Protected branches', 'protected'], ['Default branch and protected branches', 'default_and_protected']],
help: nil,
- value: nil
+ value: nil,
+ checkbox_label: nil
}
is_expected.to eq(expected_hash)