summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortiagonbotelho <tiagonbotelho@hotmail.com>2016-07-18 23:13:21 +0100
committertiagonbotelho <tiagonbotelho@hotmail.com>2016-07-18 23:13:21 +0100
commit28f85155f5125131d109629871a3257a471ad5af (patch)
tree2bfd94ba93b5c8bd6b16473683d84064c19bb9e6
parent50f3d0d4f1392b3e45abe623506965016889cf8b (diff)
downloadgitlab-ce-28f85155f5125131d109629871a3257a471ad5af.tar.gz
fixes rubocop issues and implements create_commit test
-rw-r--r--Gemfile.lock1
-rw-r--r--spec/models/repository_spec.rb20
2 files changed, 18 insertions, 3 deletions
diff --git a/Gemfile.lock b/Gemfile.lock
index 4f6a8f67a4d..7851f93485d 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -389,7 +389,6 @@ GEM
mail_room (0.8.0)
method_source (0.8.2)
mime-types (2.99.2)
- mime-types-data (3.2016.0521)
mimemagic (0.3.0)
mini_portile2 (2.1.0)
minitest (5.7.0)
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index c1ebbf9ac4e..eb71a62ec56 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -129,12 +129,28 @@ describe Repository, models: true do
end
end
+ describe :create_file do
+ it 'commits change to a file successfully' do
+ expect do
+ repository.commit_file(user, 'LICENSE', 'Copyright!',
+ 'Updates filename',
+ 'master', true)
+ end.to change { repository.commits('master').count }.by(1)
+
+ blob = Blob.decorate(repository.blob_at(repository.commits('master').first.id, 'LICENSE'))
+
+ expect(blob.data).to eq('Copyright!')
+ end
+ end
+
describe :update_file do
it 'updates filename successfully' do
- expect{repository.update_file(user, 'NEWLICENSE', 'Copyright!',
+ expect do
+ repository.update_file(user, 'NEWLICENSE', 'Copyright!',
branch: 'master',
previous_path: 'LICENSE',
- message: 'Changes filename')}.to change { repository.commits('master').count }.by(1)
+ message: 'Changes filename')
+ end.to change { repository.commits('master').count }.by(1)
files = repository.ls_files('master')