Commit 2f5fdfe3 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'multiple-trigger-variables-show-in-separate-line' into 'master'

Multiple trigger variables show in separate line

## What does this MR do?
Separate lines for multiple trigger variables

## Screenshot
![Zrzut_ekranu_2016-07-19_o_13.05.01](/uploads/a6f9ec842f65266ae38922b1e9d5ab84/Zrzut_ekranu_2016-07-19_o_13.05.01.png)

## What are the relevant issue numbers?
Closes #19006 

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- Tests
  - [x] Add tests for multiple trigger variables view
  - [x] All builds are passing
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)

cc @ubudzisz @grzesiek @yorickpeterse @tmaczukin [@chastell](https://github.com/chastell) [@tomash](https://github.com/tomash)

See merge request !5357
parents e9946f19 ea69ee19
...@@ -14,6 +14,7 @@ v 8.11.0 (unreleased) ...@@ -14,6 +14,7 @@ v 8.11.0 (unreleased)
- Load project invited groups and members eagerly in `ProjectTeam#fetch_members` - Load project invited groups and members eagerly in `ProjectTeam#fetch_members`
- Add GitLab Workhorse version to admin dashboard (Katarzyna Kobierska Ula Budziszewska) - Add GitLab Workhorse version to admin dashboard (Katarzyna Kobierska Ula Budziszewska)
- Add the `sprockets-es6` gem - Add the `sprockets-es6` gem
- Multiple trigger variables show in separate lines (Katarzyna Kobierska Ula Budziszewska)
v 8.10.2 (unreleased) v 8.10.2 (unreleased)
- User can now search branches by name. !5144 - User can now search branches by name. !5144
......
...@@ -88,8 +88,9 @@ ...@@ -88,8 +88,9 @@
%p %p
%span.build-light-text Variables: %span.build-light-text Variables:
%code
- @build.trigger_request.variables.each do |key, value| - @build.trigger_request.variables.each do |key, value|
%code
#{key}=#{value} #{key}=#{value}
.block .block
......
...@@ -5,7 +5,8 @@ FactoryGirl.define do ...@@ -5,7 +5,8 @@ FactoryGirl.define do
variables do variables do
{ {
TRIGGER_KEY: 'TRIGGER_VALUE' TRIGGER_KEY_1: 'TRIGGER_VALUE_1',
TRIGGER_KEY_2: 'TRIGGER_VALUE_2'
} }
end end
end end
......
...@@ -259,7 +259,7 @@ describe Ci::Build, models: true do ...@@ -259,7 +259,7 @@ describe Ci::Build, models: true do
let(:trigger) { create(:ci_trigger, project: project) } let(:trigger) { create(:ci_trigger, project: project) }
let(:trigger_request) { create(:ci_trigger_request_with_variables, pipeline: pipeline, trigger: trigger) } let(:trigger_request) { create(:ci_trigger_request_with_variables, pipeline: pipeline, trigger: trigger) }
let(:user_trigger_variable) do let(:user_trigger_variable) do
{ key: :TRIGGER_KEY, value: 'TRIGGER_VALUE', public: false } { key: :TRIGGER_KEY_1, value: 'TRIGGER_VALUE_1', public: false }
end end
let(:predefined_trigger_variable) do let(:predefined_trigger_variable) do
{ key: 'CI_BUILD_TRIGGERED', value: 'true', public: true } { key: 'CI_BUILD_TRIGGERED', value: 'true', public: true }
......
...@@ -98,7 +98,7 @@ describe Ci::API::API do ...@@ -98,7 +98,7 @@ describe Ci::API::API do
{ "key" => "CI_BUILD_TRIGGERED", "value" => "true", "public" => true }, { "key" => "CI_BUILD_TRIGGERED", "value" => "true", "public" => true },
{ "key" => "DB_NAME", "value" => "postgres", "public" => true }, { "key" => "DB_NAME", "value" => "postgres", "public" => true },
{ "key" => "SECRET_KEY", "value" => "secret_value", "public" => false }, { "key" => "SECRET_KEY", "value" => "secret_value", "public" => false },
{ "key" => "TRIGGER_KEY", "value" => "TRIGGER_VALUE", "public" => false } { "key" => "TRIGGER_KEY_1", "value" => "TRIGGER_VALUE_1", "public" => false }
) )
end end
......
...@@ -49,4 +49,24 @@ describe 'projects/builds/show' do ...@@ -49,4 +49,24 @@ describe 'projects/builds/show' do
text: /\A\n#{Regexp.escape(commit_title)}\n\Z/) text: /\A\n#{Regexp.escape(commit_title)}\n\Z/)
end end
end end
describe 'shows trigger variables in sidebar' do
let(:trigger_request) { create(:ci_trigger_request_with_variables, pipeline: pipeline) }
before do
build.trigger_request = trigger_request
render
end
it 'shows trigger variables in separate lines' do
expect(rendered).to have_css('code', text: variable_regexp('TRIGGER_KEY_1', 'TRIGGER_VALUE_1'))
expect(rendered).to have_css('code', text: variable_regexp('TRIGGER_KEY_2', 'TRIGGER_VALUE_2'))
end
end
private
def variable_regexp(key, value)
/\A#{Regexp.escape("#{key}=#{value}")}\Z/
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment