debian-mirror-gitlab/spec/features/projects/files/editing_a_file_spec.rb

32 lines
1,019 B
Ruby
Raw Normal View History

2016-09-13 17:45:13 +05:30
require 'spec_helper'
2018-10-15 14:42:47 +05:30
describe 'Projects > Files > User wants to edit a file' do
2017-09-10 17:25:29 +05:30
let(:project) { create(:project, :repository) }
2018-10-15 14:42:47 +05:30
let(:user) { project.owner }
2016-09-13 17:45:13 +05:30
let(:commit_params) do
{
2017-08-17 22:00:37 +05:30
start_branch: project.default_branch,
branch_name: project.default_branch,
2016-09-13 17:45:13 +05:30
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
2018-10-15 14:42:47 +05:30
before do
2017-09-10 17:25:29 +05:30
sign_in user
visit project_edit_blob_path(project,
2016-09-13 17:45:13 +05:30
File.join(project.default_branch, '.gitignore'))
end
2018-10-15 14:42:47 +05:30
it 'file has been updated since the user opened the edit page' do
2016-09-13 17:45:13 +05:30
Files::UpdateService.new(project, user, commit_params).execute
2017-08-17 22:00:37 +05:30
click_button 'Commit changes'
2016-09-13 17:45:13 +05:30
expect(page).to have_content 'Someone edited the file the same time you did.'
end
end