Commit da49a357 authored by Robert Speicher's avatar Robert Speicher

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
parents f4e234d9 ba1e8f82
...@@ -490,43 +490,43 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -490,43 +490,43 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
id: job.id id: job.id
end 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) } let(:job) { create(:ci_build, :trace_artifact, pipeline: pipeline) }
it 'returns a trace' do it 'returns a trace' do
response = subject response = subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'text/plain; charset=utf-8' expect(response.headers["Content-Type"]).to eq("text/plain; charset=utf-8")
expect(response.body).to eq job.job_artifacts_trace.open.read expect(response.body).to eq(job.job_artifacts_trace.open.read)
end end
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) } let(:job) { create(:ci_build, :trace_live, pipeline: pipeline) }
it 'send a trace file' do it "send a trace file" do
response = subject response = subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'text/plain; charset=utf-8' expect(response.headers["Content-Type"]).to eq("text/plain; charset=utf-8")
expect(response.body).to eq 'BUILD TRACE' expect(response.body).to eq("BUILD TRACE")
end end
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) } let(:job) { create(:ci_build, pipeline: pipeline) }
before do before do
job.update_column(:trace, 'Sample trace') job.update_column(:trace, "Sample trace")
end end
it 'send a trace file' do it "send a trace file" do
response = subject response = subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'text/plain; charset=utf-8' expect(response.headers["Content-Type"]).to eq("text/plain; charset=utf-8")
expect(response.body).to eq 'Sample trace' expect(response.body).to eq("Sample trace")
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment