From b13502ef825ec6f105ab47a29e7d397636c4d03b Mon Sep 17 00:00:00 2001 From: Katarzyna Kobierska Date: Fri, 9 Sep 2016 14:43:43 +0200 Subject: [PATCH] Add test for linter values visibility --- app/views/ci/lints/_create.html.haml | 2 +- spec/views/ci/lints/show.html.haml_spec.rb | 33 ++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 spec/views/ci/lints/show.html.haml_spec.rb diff --git a/app/views/ci/lints/_create.html.haml b/app/views/ci/lints/_create.html.haml index 59be8bbad81..733c5d0b7fe 100644 --- a/app/views/ci/lints/_create.html.haml +++ b/app/views/ci/lints/_create.html.haml @@ -21,7 +21,7 @@ %br %b Tag list: - = build[:tag_list] + = build[:tag_list] && build[:tag_list].join(", ") %br %b Refs only: = build[:only] && build[:only].join(", ") 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..f1d91eab356 --- /dev/null +++ b/spec/views/ci/lints/show.html.haml_spec.rb @@ -0,0 +1,33 @@ +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 content is valid' do + before do + assign(:status, true) + assign(:builds, config_processor.builds) + assign(:stages, config_processor.stages) + end + + it 'shows 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 +end