[Rails5] Fix spec/controllers/projects/jobs_controller_spec.rb
In Rails 5.0 `response.content_type` does not return charset which is expected in specs. This commit replaces `response.content_type` with `response.headers["Content-Type"]` in specs.
This commit is contained in:
parent
35816eb7be
commit
ba1e8f822a
1 changed files with 12 additions and 12 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue