summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortiagonbotelho <tiagonbotelho@hotmail.com>2016-07-18 14:53:27 +0100
committertiagonbotelho <tiagonbotelho@hotmail.com>2016-07-18 14:53:27 +0100
commitc6097f24d32610d4c12ae0e9d16b72dc53cda9da (patch)
treee137632e18fc1561ea3558660870cd8bc68a7178
parent2e021c4e17f0ffb223d388ef4c177f82f162e805 (diff)
downloadgitlab-ce-c6097f24d32610d4c12ae0e9d16b72dc53cda9da.tar.gz
adds test for update_file method
-rw-r--r--spec/models/repository_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 24e49c8def3..75afb0c1022 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -129,6 +129,20 @@ describe Repository, models: true do
end
end
+ describe :update_file do
+ it 'updates filename successfully' do
+ expect{repository.update_file(user, 'NEWLICENSE', 'Copyright!',
+ branch: 'master',
+ previous_path: 'LICENSE',
+ message: 'Changes filename')}.to change { repository.commits('master').count }.by(1)
+
+ files = repository.ls_files('master')
+
+ expect(files).not_to include('LICENSE')
+ expect(files).to include('NEWLICENSE')
+ end
+ end
+
describe "search_files" do
let(:results) { repository.search_files('feature', 'master') }
subject { results }