Merge branch 'b-rails5-fix-spec-controllers-projects-jobs_controller_spec-rb' into 'master'

Resolve "[Rails5] Fix spec/controllers/projects/jobs_controller_spec.rb"

Closes #46227

See merge request gitlab-org/gitlab-ce!18891
This commit is contained in:
Robert Speicher 2018-05-11 16:43:46 +00:00
commit da49a357da

View file

@ -490,43 +490,43 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
id: job.id
end
context 'when job has a trace artifact' do
context "when job has a trace artifact" do
let(:job) { create(:ci_build, :trace_artifact, pipeline: pipeline) }
it 'returns a trace' do
response = subject
expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'text/plain; charset=utf-8'
expect(response.body).to eq job.job_artifacts_trace.open.read
expect(response.headers["Content-Type"]).to eq("text/plain; charset=utf-8")
expect(response.body).to eq(job.job_artifacts_trace.open.read)
end
end
context 'when job has a trace file' do
context "when job has a trace file" do
let(:job) { create(:ci_build, :trace_live, pipeline: pipeline) }
it 'send a trace file' do
it "send a trace file" do
response = subject
expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'text/plain; charset=utf-8'
expect(response.body).to eq 'BUILD TRACE'
expect(response.headers["Content-Type"]).to eq("text/plain; charset=utf-8")
expect(response.body).to eq("BUILD TRACE")
end
end
context 'when job has a trace in database' do
context "when job has a trace in database" do
let(:job) { create(:ci_build, pipeline: pipeline) }
before do
job.update_column(:trace, 'Sample trace')
job.update_column(:trace, "Sample trace")
end
it 'send a trace file' do
it "send a trace file" do
response = subject
expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'text/plain; charset=utf-8'
expect(response.body).to eq 'Sample trace'
expect(response.headers["Content-Type"]).to eq("text/plain; charset=utf-8")
expect(response.body).to eq("Sample trace")
end
end