diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-09-26 12:43:55 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-09-26 12:48:43 +0300 |
commit | 528b988aea44cc1016ee5a3c09ce0d383114e395 (patch) | |
tree | 83fe8450587dc108a794b71e600e728029791eeb /spec/views | |
parent | fca610e5cbf5382f3814120227a0ca11440c8a9f (diff) |
Escape HTML nodes in builds commands in ci linter
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/ci/lints/show.html.haml_spec.rb | 35 |
1 files changed, 35 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..3a65a86cd88 --- /dev/null +++ b/spec/views/ci/lints/show.html.haml_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +describe 'ci/lints/show' do + include Devise::TestHelpers + + before do + assign(:status, true) + assign(:stages, %w[test]) + assign(:builds, builds) + end + + context 'when builds attrbiutes contain HTML nodes' do + let(:builds) do + [ { name: 'rspec', stage: 'test', commands: '<h1>rspec</h1>' } ] + end + + it 'does not render HTML elements' do + render + + expect(rendered).not_to have_css('h1', text: 'rspec') + end + end + + context 'when builds attributes do not contain HTML nodes' do + let(:builds) do + [ { name: 'rspec', stage: 'test', commands: 'rspec' } ] + end + + it 'shows configuration in the table' do + render + + expect(rendered).to have_css('td pre', text: 'rspec') + end + end +end |