2016-08-07 23:29:23 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-06-29 00:13:10 -04:00
|
|
|
feature 'User wants to edit a file' do
|
2016-08-07 23:29:23 -04:00
|
|
|
let(:project) { create(:project) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:commit_params) do
|
|
|
|
{
|
2017-01-06 10:50:08 -05:00
|
|
|
start_branch: project.default_branch,
|
2017-04-19 20:37:44 -04:00
|
|
|
branch_name: project.default_branch,
|
2016-08-07 23:29:23 -04:00
|
|
|
commit_message: "Committing First Update",
|
|
|
|
file_path: ".gitignore",
|
|
|
|
file_content: "First Update",
|
|
|
|
last_commit_sha: Gitlab::Git::Commit.last_for_path(project.repository, project.default_branch,
|
|
|
|
".gitignore").sha
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
background do
|
|
|
|
project.team << [user, :master]
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in user
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_edit_blob_path(project,
|
2016-08-07 23:29:23 -04:00
|
|
|
File.join(project.default_branch, '.gitignore'))
|
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'file has been updated since the user opened the edit page' do
|
|
|
|
Files::UpdateService.new(project, user, commit_params).execute
|
|
|
|
|
2017-04-04 14:06:32 -04:00
|
|
|
click_button 'Commit changes'
|
2016-08-07 23:29:23 -04:00
|
|
|
|
|
|
|
expect(page).to have_content 'Someone edited the file the same time you did.'
|
|
|
|
end
|
|
|
|
end
|