summaryrefslogtreecommitdiff
path: root/spec/views
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-09-30 16:51:47 +0000
committerRémy Coutable <remy@rymai.me>2016-09-30 16:51:47 +0000
commit7a5156d6955437e544716e51942ac5ab1645582b (patch)
treed99ab606d5e87df624e76876147f8b2cf732140b /spec/views
parent9a79c9e98079ab21428289af9ec5dd3f0583c375 (diff)
parente26ea861575d575f5b1daf051c3864831bbcba97 (diff)
downloadgitlab-ce-7a5156d6955437e544716e51942ac5ab1645582b.tar.gz
Merge branch '21744-fix-missing-values-in-linter' into 'master'
Add missing values to linter (`only`, `except`) and add new one `Environment` Closes #21744 See merge request !6276
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/ci/lints/show.html.haml_spec.rb51
1 files changed, 51 insertions, 0 deletions
diff --git a/spec/views/ci/lints/show.html.haml_spec.rb b/spec/views/ci/lints/show.html.haml_spec.rb
new file mode 100644
index 00000000000..793b747e7eb
--- /dev/null
+++ b/spec/views/ci/lints/show.html.haml_spec.rb
@@ -0,0 +1,51 @@
+require 'spec_helper'
+
+describe 'ci/lints/show' do
+ let(:content) do
+ {
+ build_template: {
+ script: './build.sh',
+ tags: ['dotnet'],
+ only: ['test@dude/repo'],
+ except: ['deploy'],
+ environment: 'testing'
+ }
+ }
+ end
+
+ let(:config_processor) { Ci::GitlabCiYamlProcessor.new(YAML.dump(content)) }
+
+ context 'when the content is valid' do
+ before do
+ assign(:status, true)
+ assign(:builds, config_processor.builds)
+ assign(:stages, config_processor.stages)
+ assign(:jobs, config_processor.jobs)
+ end
+
+ it 'shows the correct values' do
+ render
+
+ expect(rendered).to have_content('Tag list: dotnet')
+ expect(rendered).to have_content('Refs only: test@dude/repo')
+ expect(rendered).to have_content('Refs except: deploy')
+ expect(rendered).to have_content('Environment: testing')
+ expect(rendered).to have_content('When: on_success')
+ end
+ end
+
+ context 'when the content is invalid' do
+ before do
+ assign(:status, false)
+ assign(:error, 'Undefined error')
+ end
+
+ it 'shows error message' do
+ render
+
+ expect(rendered).to have_content('Status: syntax is incorrect')
+ expect(rendered).to have_content('Error: Undefined error')
+ expect(rendered).not_to have_content('Tag list:')
+ end
+ end
+end