diff options
author | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-08-01 18:00:44 +0300 |
---|---|---|
committer | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-08-09 17:11:39 +0300 |
commit | 1d268a89deef10854193db48d65cf5d519a0363d (patch) | |
tree | 59765b4a2f83b453875fa7aefe9b7ab5c65e3c67 /spec/requests/api/files_spec.rb | |
parent | 519275c1102ad8a1d56f5807de2d8a1ae4b21dc0 (diff) |
adds second batch of tests changed to active tense
Diffstat (limited to 'spec/requests/api/files_spec.rb')
-rw-r--r-- | spec/requests/api/files_spec.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/spec/requests/api/files_spec.rb b/spec/requests/api/files_spec.rb index 2e5448143d5..2d1213df8a7 100644 --- a/spec/requests/api/files_spec.rb +++ b/spec/requests/api/files_spec.rb @@ -9,7 +9,7 @@ describe API::API, api: true do before { project.team << [user, :developer] } describe "GET /projects/:id/repository/files" do - it "should return file info" do + it "returns file info" do params = { file_path: file_path, ref: 'master', @@ -23,12 +23,12 @@ describe API::API, api: true do expect(Base64.decode64(json_response['content']).lines.first).to eq("require 'fileutils'\n") end - it "should return a 400 bad request if no params given" do + it "returns a 400 bad request if no params given" do get api("/projects/#{project.id}/repository/files", user) expect(response).to have_http_status(400) end - it "should return a 404 if such file does not exist" do + it "returns a 404 if such file does not exist" do params = { file_path: 'app/models/application.rb', ref: 'master', @@ -49,18 +49,18 @@ describe API::API, api: true do } end - it "should create a new file in project repo" do + it "creates a new file in project repo" do post api("/projects/#{project.id}/repository/files", user), valid_params expect(response).to have_http_status(201) expect(json_response['file_path']).to eq('newfile.rb') end - it "should return a 400 bad request if no params given" do + it "returns a 400 bad request if no params given" do post api("/projects/#{project.id}/repository/files", user) expect(response).to have_http_status(400) end - it "should return a 400 if editor fails to create file" do + it "returns a 400 if editor fails to create file" do allow_any_instance_of(Repository).to receive(:commit_file). and_return(false) @@ -79,13 +79,13 @@ describe API::API, api: true do } end - it "should update existing file in project repo" do + it "updates existing file in project repo" do put api("/projects/#{project.id}/repository/files", user), valid_params expect(response).to have_http_status(200) expect(json_response['file_path']).to eq(file_path) end - it "should return a 400 bad request if no params given" do + it "returns a 400 bad request if no params given" do put api("/projects/#{project.id}/repository/files", user) expect(response).to have_http_status(400) end @@ -100,18 +100,18 @@ describe API::API, api: true do } end - it "should delete existing file in project repo" do + it "deletes existing file in project repo" do delete api("/projects/#{project.id}/repository/files", user), valid_params expect(response).to have_http_status(200) expect(json_response['file_path']).to eq(file_path) end - it "should return a 400 bad request if no params given" do + it "returns a 400 bad request if no params given" do delete api("/projects/#{project.id}/repository/files", user) expect(response).to have_http_status(400) end - it "should return a 400 if fails to create file" do + it "returns a 400 if fails to create file" do allow_any_instance_of(Repository).to receive(:remove_file).and_return(false) delete api("/projects/#{project.id}/repository/files", user), valid_params |