Commit 28f85155 authored by tiagonbotelho's avatar tiagonbotelho

fixes rubocop issues and implements create_commit test

parent 50f3d0d4
...@@ -389,7 +389,6 @@ GEM ...@@ -389,7 +389,6 @@ GEM
mail_room (0.8.0) mail_room (0.8.0)
method_source (0.8.2) method_source (0.8.2)
mime-types (2.99.2) mime-types (2.99.2)
mime-types-data (3.2016.0521)
mimemagic (0.3.0) mimemagic (0.3.0)
mini_portile2 (2.1.0) mini_portile2 (2.1.0)
minitest (5.7.0) minitest (5.7.0)
......
...@@ -129,12 +129,28 @@ describe Repository, models: true do ...@@ -129,12 +129,28 @@ describe Repository, models: true do
end end
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 describe :update_file do
it 'updates filename successfully' do it 'updates filename successfully' do
expect{repository.update_file(user, 'NEWLICENSE', 'Copyright!', expect do
repository.update_file(user, 'NEWLICENSE', 'Copyright!',
branch: 'master', branch: 'master',
previous_path: 'LICENSE', 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') files = repository.ls_files('master')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment