Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2018-03-13 20:57:16 +0300
committerMayra Cabrera <mcabrera@gitlab.com>2018-03-27 02:03:11 +0300
commit80f9aff34b07fd8dc490a06cd6281b5af4310438 (patch)
tree122af68d566127acd61131bdaae581fedd7b87b9 /spec/features/projects/ci/lint_spec.rb
parent7c02d0cff3d79d9159b2966ce4807b71c4eff358 (diff)
Make ci/lint page context aware:
- Create ci/lints controller inside project/ - Move js pages to be inside projects/ - Copy view ci/lint view to be inside project folder - Remove ci/lint view and js files Closes #43603
Diffstat (limited to 'spec/features/projects/ci/lint_spec.rb')
-rw-r--r--spec/features/projects/ci/lint_spec.rb74
1 files changed, 74 insertions, 0 deletions
diff --git a/spec/features/projects/ci/lint_spec.rb b/spec/features/projects/ci/lint_spec.rb
new file mode 100644
index 00000000000..313950072e7
--- /dev/null
+++ b/spec/features/projects/ci/lint_spec.rb
@@ -0,0 +1,74 @@
+require 'spec_helper'
+
+describe 'CI Lint', :js do
+ let(:project) { create(:project, :repository) }
+ let(:user) { create(:user) }
+
+ before do
+ project.add_developer(user)
+ sign_in(user)
+
+ visit project_ci_lint_path(project)
+ find('#ci-editor')
+ execute_script("ace.edit('ci-editor').setValue(#{yaml_content.to_json});")
+
+ # Ace editor updates a hidden textarea and it happens asynchronously
+ wait_for('YAML content') do
+ find('.ace_content').text.present?
+ end
+ end
+
+ describe 'YAML parsing' do
+ before do
+ click_on 'Validate'
+ end
+
+ context 'YAML is correct' do
+ let(:yaml_content) do
+ File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
+ end
+
+ it 'parses Yaml' do
+ within "table" do
+ expect(page).to have_content('Job - rspec')
+ expect(page).to have_content('Job - spinach')
+ expect(page).to have_content('Deploy Job - staging')
+ expect(page).to have_content('Deploy Job - production')
+ end
+ end
+ end
+
+ context 'YAML is incorrect' do
+ let(:yaml_content) { 'value: cannot have :' }
+
+ it 'displays information about an error' do
+ expect(page).to have_content('Status: syntax is incorrect')
+ expect(page).to have_selector('.ace_content', text: yaml_content)
+ end
+ end
+
+ describe 'YAML revalidate' do
+ let(:yaml_content) { 'my yaml content' }
+
+ it 'loads previous YAML content after validation' do
+ expect(page).to have_field('content', with: 'my yaml content', visible: false, type: 'textarea')
+ end
+ end
+ end
+
+ describe 'YAML clearing' do
+ before do
+ click_on 'Clear'
+ end
+
+ context 'YAML is present' do
+ let(:yaml_content) do
+ File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
+ end
+
+ it 'YAML content is cleared' do
+ expect(page).to have_field('content', with: '', visible: false, type: 'textarea')
+ end
+ end
+ end
+end