summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-07-19 15:37:39 +0000
committerDouwe Maan <douwe@gitlab.com>2016-07-19 15:37:39 +0000
commit81e57e783e8882de21d27d9191c09404ed7faca3 (patch)
treee7c86ebcd9a2cc696901a01df3aff9d899cb8441 /spec
parente953b8afd2efe042c72ec8be2b9ad35ee04f8723 (diff)
parentff059360587f61907fb0a2691984ddd05fe049b9 (diff)
downloadgitlab-ce-81e57e783e8882de21d27d9191c09404ed7faca3.tar.gz
Merge branch 'rename-repo-files' into 'master'
Implements the form for renaming the new filename on the file edit page ## What does this MR do? Adds the possibility to edit a filename when editing the content of a file on Gitlab this MR was made to solve #5850 ![Screen_Shot_2016-07-01_at_16.45.53](/uploads/eeed05800e3dc11f1e3840e0e4fa06b5/Screen_Shot_2016-07-01_at_16.45.53.png) See merge request !5049
Diffstat (limited to 'spec')
-rw-r--r--spec/models/repository_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index e14cec589fe..110df6bbd22 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -130,6 +130,36 @@ describe Repository, models: true do
end
end
+ describe :commit_file do
+ it 'commits change to a file successfully' do
+ expect do
+ repository.commit_file(user, 'CHANGELOG', 'Changelog!',
+ 'Updates file content',
+ 'master', true)
+ end.to change { repository.commits('master').count }.by(1)
+
+ blob = repository.blob_at('master', 'CHANGELOG')
+
+ expect(blob.data).to eq('Changelog!')
+ end
+ end
+
+ describe :update_file do
+ it 'updates filename successfully' do
+ expect do
+ repository.update_file(user, 'NEWLICENSE', 'Copyright!',
+ branch: 'master',
+ previous_path: 'LICENSE',
+ message: 'Changes filename')
+ end.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 }