blob: 0ad44f31a52695d436302fc027d9d117778870d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Projects > Files > Project owner sees a link to create a license file in empty project', :js do
include WebIdeSpecHelpers
let(:project) { create(:project_empty_repo) }
let(:project_maintainer) { project.first_owner }
before do
sign_in(project_maintainer)
end
it 'allows project maintainer creates a license file from a template in Web IDE' do
visit project_path(project)
click_on 'Add LICENSE'
expect(page).to have_current_path("/-/ide/project/#{project.full_path}/edit/master/-/LICENSE", ignore_query: true)
expect(page).to have_selector('[data-testid="file-templates-bar"]')
select_template('MIT License')
file_content = "Copyright (c) #{Time.zone.now.year} #{project.namespace.human_name}"
expect(find('.monaco-editor')).to have_content('MIT License')
expect(find('.monaco-editor')).to have_content(file_content)
ide_commit
expect(page).to have_current_path("/-/ide/project/#{project.full_path}/tree/master/-/LICENSE/", ignore_query: true)
expect(page).to have_content('All changes are committed')
license_file = project.repository.blob_at('master', 'LICENSE').data
expect(license_file).to have_content('MIT License')
expect(license_file).to have_content(file_content)
end
def select_template(template)
click_button 'Choose a template...'
click_button template
wait_for_requests
end
end
|