diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-05-03 14:21:06 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-05-03 14:21:06 +0900 |
commit | 30464bceaac08bf7a8415df7d3b1e0ddf6182762 (patch) | |
tree | 39a5ac6dc729edc105d7654835ac66d9aa16599d /spec/services | |
parent | 9ad20891435f1f51ae6e8e951b84131480d1ab97 (diff) | |
parent | b2e1b70927f94a50a83e5afef359775894bd6b03 (diff) | |
download | gitlab-ce-30464bceaac08bf7a8415df7d3b1e0ddf6182762.tar.gz |
Merge branch 'master' into live-trace-v2
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/applications/create_service_spec.rb | 14 | ||||
-rw-r--r-- | spec/services/ci/retry_build_service_spec.rb | 4 | ||||
-rw-r--r-- | spec/services/merge_requests/merge_service_spec.rb | 4 | ||||
-rw-r--r-- | spec/services/projects/update_pages_service_spec.rb | 10 |
4 files changed, 20 insertions, 12 deletions
diff --git a/spec/services/applications/create_service_spec.rb b/spec/services/applications/create_service_spec.rb index 47a2a9d6403..9c43b56744b 100644 --- a/spec/services/applications/create_service_spec.rb +++ b/spec/services/applications/create_service_spec.rb @@ -1,13 +1,17 @@ -require 'spec_helper' +require "spec_helper" describe ::Applications::CreateService do let(:user) { create(:user) } let(:params) { attributes_for(:application) } - let(:request) { ActionController::TestRequest.new(remote_ip: '127.0.0.1') } + let(:request) do + if Gitlab.rails5? + ActionController::TestRequest.new({ remote_ip: "127.0.0.1" }, ActionController::TestSession.new) + else + ActionController::TestRequest.new(remote_ip: "127.0.0.1") + end + end subject { described_class.new(user, params) } - it 'creates an application' do - expect { subject.execute(request) }.to change { Doorkeeper::Application.count }.by(1) - end + it { expect { subject.execute(request) }.to change { Doorkeeper::Application.count }.by(1) } end diff --git a/spec/services/ci/retry_build_service_spec.rb b/spec/services/ci/retry_build_service_spec.rb index cc200f6fc0a..e1cb7ed8110 100644 --- a/spec/services/ci/retry_build_service_spec.rb +++ b/spec/services/ci/retry_build_service_spec.rb @@ -6,7 +6,9 @@ describe Ci::RetryBuildService do set(:pipeline) { create(:ci_pipeline, project: project) } let(:stage) do - Ci::Stage.create!(project: project, pipeline: pipeline, name: 'test') + create(:ci_stage_entity, project: project, + pipeline: pipeline, + name: 'test') end let(:build) { create(:ci_build, pipeline: pipeline, stage_id: stage.id) } diff --git a/spec/services/merge_requests/merge_service_spec.rb b/spec/services/merge_requests/merge_service_spec.rb index c38ddf4612b..e8568bf8bb3 100644 --- a/spec/services/merge_requests/merge_service_spec.rb +++ b/spec/services/merge_requests/merge_service_spec.rb @@ -219,7 +219,7 @@ describe MergeRequests::MergeService do service.execute(merge_request) - expect(merge_request.merge_error).to include(error_message) + expect(merge_request.merge_error).to include('Something went wrong during merge') expect(Rails.logger).to have_received(:error).with(a_string_matching(error_message)) end @@ -231,7 +231,7 @@ describe MergeRequests::MergeService do service.execute(merge_request) - expect(merge_request.merge_error).to include(error_message) + expect(merge_request.merge_error).to include('Something went wrong during merge pre-receive hook') expect(Rails.logger).to have_received(:error).with(a_string_matching(error_message)) end diff --git a/spec/services/projects/update_pages_service_spec.rb b/spec/services/projects/update_pages_service_spec.rb index a418808fd26..347ac13828c 100644 --- a/spec/services/projects/update_pages_service_spec.rb +++ b/spec/services/projects/update_pages_service_spec.rb @@ -123,11 +123,13 @@ describe Projects::UpdatePagesService do expect(execute).not_to eq(:success) end - it 'fails for empty file fails' do - build.job_artifacts_archive.update_attributes(file: empty_file) + context 'when using empty file' do + let(:file) { empty_file } - expect { execute } - .to raise_error(Projects::UpdatePagesService::FailedToExtractError) + it 'fails to extract' do + expect { execute } + .to raise_error(Projects::UpdatePagesService::FailedToExtractError) + end end context 'when timeout happens by DNS error' do |