[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:
blackst0ne 2018-05-11 12:02:39 +11:00
parent 35816eb7be
commit ba1e8f822a
1 changed files with 12 additions and 12 deletions

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