2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Projects > Files > Project owner sees a link to create a license file in empty project', :js do
|
2021-01-03 14:25:43 +05:30
|
|
|
include WebIdeSpecHelpers
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
let(:project) { create(:project_empty_repo) }
|
2018-11-18 11:00:15 +05:30
|
|
|
let(:project_maintainer) { project.owner }
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
sign_in(project_maintainer)
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
it 'allows project maintainer creates a license file from a template in Web IDE' do
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_path(project)
|
2019-12-26 22:10:19 +05:30
|
|
|
click_on 'Add LICENSE'
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
expect(current_path).to eq("/-/ide/project/#{project.full_path}/edit/master/-/LICENSE")
|
|
|
|
|
|
|
|
expect(page).to have_selector('.qa-file-templates-bar')
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2016-06-22 15:30:34 +05:30
|
|
|
select_template('MIT License')
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
expect(ide_editor_value).to have_content('MIT License')
|
|
|
|
expect(ide_editor_value).to have_content("Copyright (c) #{Time.now.year} #{project.namespace.human_name}")
|
|
|
|
|
|
|
|
ide_commit
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
expect(current_path).to eq("/-/ide/project/#{project.full_path}/tree/master/-/LICENSE/")
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
expect(page).to have_content('All changes are committed')
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
license_file = project.repository.blob_at('master', 'LICENSE').data
|
|
|
|
expect(license_file).to have_content('MIT License')
|
|
|
|
expect(license_file).to have_content("Copyright (c) #{Time.now.year} #{project.namespace.human_name}")
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
2016-06-22 15:30:34 +05:30
|
|
|
|
|
|
|
def select_template(template)
|
2021-01-03 14:25:43 +05:30
|
|
|
click_button 'Choose a template...'
|
|
|
|
click_button template
|
|
|
|
wait_for_requests
|
2016-06-22 15:30:34 +05:30
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|