fixes rubocop issues and implements create_commit test

This commit is contained in:
tiagonbotelho 2016-07-18 23:13:21 +01:00
parent 50f3d0d4f1
commit 28f85155f5
2 changed files with 18 additions and 3 deletions

View file

@ -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)

View file

@ -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')