Skip to content
Snippets Groups Projects
Commit 6b9d3a4e authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 23288f62
No related branches found
No related tags found
No related merge requests found
# frozen_string_literal: true
 
require 'active_support/core_ext/hash/transform_values'
require 'active_support/hash_with_indifferent_access'
require 'active_support/dependencies'
 
Loading
Loading
Loading
Loading
@@ -41,13 +41,11 @@ RSpec.shared_examples 'a controller that can serve LFS files' do |options = {}|
it 'serves the file' do
lfs_uploader = LfsObjectUploader.new(lfs_object)
 
# Notice the filename= is omitted from the disposition; this is because
# Rails 5 will append this header in send_file
expect(controller).to receive(:send_file)
.with(
File.join(lfs_uploader.root, lfs_uploader.store_dir, lfs_uploader.filename),
filename: filename,
disposition: %Q(attachment; filename*=UTF-8''#{filename}))
disposition: 'attachment')
 
subject
 
Loading
Loading
Loading
Loading
@@ -50,3 +50,38 @@ RSpec.shared_examples 'raises error for users with insufficient permissions' do
it_behaves_like 'misconfigured dashboard service response', :unauthorized
end
end
RSpec.shared_examples 'valid dashboard cloning process' do |dashboard_template, sequence|
context "dashboard template: #{dashboard_template}" do
let(:dashboard) { dashboard_template }
let(:dashboard_attrs) do
{
commit_message: commit_message,
branch_name: branch,
start_branch: project.default_branch,
encoding: 'text',
file_path: ".gitlab/dashboards/#{file_name}",
file_content: file_content_hash.to_yaml
}
end
it 'delegates commit creation to Files::CreateService', :aggregate_failures do
service_instance = instance_double(::Files::CreateService)
expect(::Files::CreateService).to receive(:new).with(project, user, dashboard_attrs).and_return(service_instance)
expect(service_instance).to receive(:execute).and_return(status: :success)
service_call
end
context 'user has defined custom metrics' do
it 'uses external service to includes them into new file content', :aggregate_failures do
service_instance = double(::Gitlab::Metrics::Dashboard::Processor)
expect(::Gitlab::Metrics::Dashboard::Processor).to receive(:new).with(project, file_content_hash, sequence, {}).and_return(service_instance)
expect(service_instance).to receive(:process).and_return(file_content_hash)
expect(::Files::CreateService).to receive(:new).with(project, user, dashboard_attrs).and_return(double(execute: { status: :success }))
service_call
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment