diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-07-19 15:37:39 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-07-19 15:37:39 +0000 |
commit | 81e57e783e8882de21d27d9191c09404ed7faca3 (patch) | |
tree | e7c86ebcd9a2cc696901a01df3aff9d899cb8441 /spec | |
parent | e953b8afd2efe042c72ec8be2b9ad35ee04f8723 (diff) | |
parent | ff059360587f61907fb0a2691984ddd05fe049b9 (diff) | |
download | gitlab-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

See merge request !5049
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/repository_spec.rb | 30 |
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 } |