From b7e98620046501144302ff8f9fbf22ff03ef4db7 Mon Sep 17 00:00:00 2001 From: Felipe Artur Date: Thu, 10 Aug 2017 16:16:54 -0300 Subject: Fix API responses when dealing with txt files --- spec/requests/api/files_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/requests/api/files_spec.rb') diff --git a/spec/requests/api/files_spec.rb b/spec/requests/api/files_spec.rb index 55c998b13b8..ea97c556430 100644 --- a/spec/requests/api/files_spec.rb +++ b/spec/requests/api/files_spec.rb @@ -33,6 +33,15 @@ describe API::Files do expect(Base64.decode64(json_response['content']).lines.first).to eq("require 'fileutils'\n") end + it 'returns json when file has txt extension' do + file_path = "bar%2Fbranch-test.txt" + + get api(route(file_path), current_user), params + + expect(response).to have_http_status(200) + expect(response.content_type).to eq('application/json') + end + it 'returns file by commit sha' do # This file is deleted on HEAD file_path = "files%2Fjs%2Fcommit%2Ejs%2Ecoffee" @@ -220,6 +229,7 @@ describe API::Files do post api(route("new_file_with_author%2Etxt"), user), valid_params expect(response).to have_http_status(201) + expect(response.content_type).to eq('application/json') last_commit = project.repository.commit.raw expect(last_commit.author_email).to eq(author_email) expect(last_commit.author_name).to eq(author_name) -- cgit v1.2.1