diff options
Diffstat (limited to 'spec/features/projects/ci')
-rw-r--r-- | spec/features/projects/ci/lint_spec.rb | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/spec/features/projects/ci/lint_spec.rb b/spec/features/projects/ci/lint_spec.rb index f3845bb8dec..ba063acbe70 100644 --- a/spec/features/projects/ci/lint_spec.rb +++ b/spec/features/projects/ci/lint_spec.rb @@ -21,32 +21,48 @@ RSpec.describe 'CI Lint', :js do end describe 'YAML parsing' do - before do - click_on 'Validate' - end + shared_examples 'validates the YAML' 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')) + 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 and displays the jobs' do + expect(page).to have_content('Status: syntax is correct') + + within "table" do + aggregate_failures 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 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') + 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 end - context 'YAML is incorrect' do - let(:yaml_content) { 'value: cannot have :' } + it_behaves_like 'validates the YAML' - 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) + context 'when Dry Run is checked' do + before do + check 'Simulate a pipeline created for the default branch' end + + it_behaves_like 'validates the YAML' end describe 'YAML revalidate' do |