summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-06-05 20:02:13 +0300
committerValery Sizov <vsv2711@gmail.com>2015-06-05 20:02:13 +0300
commitaa8710eea74b0fede88e2d5c52c5c4c6dfb6adb2 (patch)
tree7e02f5447aa314e40f53fac3b609fe4582620300
parent8fd850f1d5997cda17efeccf41dcdab49cf8a81a (diff)
downloadgitlab-ci-aa8710eea74b0fede88e2d5c52c5c4c6dfb6adb2.tar.gz
specs for variables
-rw-r--r--app/views/variables/index.html.haml13
-rw-r--r--spec/features/variables_spec.rb26
2 files changed, 35 insertions, 4 deletions
diff --git a/app/views/variables/index.html.haml b/app/views/variables/index.html.haml
index c2e229b..87d64c4 100644
--- a/app/views/variables/index.html.haml
+++ b/app/views/variables/index.html.haml
@@ -1,5 +1,10 @@
-%p.slead
- Define additional environment variables which will be used by runner
+%h3 Secret Variables
+%p.light
+ These variables will be set to environment by the runner and will be hidden in the build log.
+ %br
+ So you can use them for passwords, secret keys ot whatever you want.
+
+%hr
= nested_form_for @project, html: { class: 'form-horizontal' } do |f|
@@ -13,12 +18,12 @@
= f.fields_for :variables do |variable_form|
.form-group
- = f.label :key, 'Key', class: 'control-label'
+ = variable_form.label :key, 'Key', class: 'control-label'
.col-sm-10
= variable_form.text_field :key, class: 'form-control', placeholder: "PROJECT_VARIABLE"
.form-group
- = f.label :commands, 'Value', class: 'control-label'
+ = variable_form.label :value, 'Value', class: 'control-label'
.col-sm-10
= variable_form.text_area :value, class: 'form-control', rows: 2, placeholder: ""
diff --git a/spec/features/variables_spec.rb b/spec/features/variables_spec.rb
new file mode 100644
index 0000000..21a7a11
--- /dev/null
+++ b/spec/features/variables_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper'
+
+describe "Variables" do
+ before do
+ login_as :user
+ end
+
+ describe "specific runners" do
+ before do
+ @project = FactoryGirl.create :project
+ stub_js_gitlab_calls
+ end
+
+ it "creates variable", js: true do
+ visit project_variables_path(@project)
+ click_on "Add a variable"
+ fill_in "Key", with: "SECRET_KEY"
+ fill_in "Value", with: "SECRET_VALUE"
+ click_on "Save changes"
+
+ page.should have_content("Project was successfully updated.")
+ @project.variables.count.should == 1
+ end
+
+ end
+end