Skip to content
Snippets Groups Projects
Commit 99428f19 authored by Phil Hughes's avatar Phil Hughes
Browse files

Updated project variable tests

parent bda2c44a
No related branches found
No related tags found
No related merge requests found
.table-responsive .table-responsive.variables-table
%table.table %table.table
%colgroup %colgroup
%col %col
Loading
@@ -14,11 +14,11 @@
Loading
@@ -14,11 +14,11 @@
%td= variable.key %td= variable.key
%td= variable.value %td= variable.value
%td %td
= link_to namespace_project_variable_path(@project.namespace, @project, variable), class: "btn btn-transparent" do = link_to namespace_project_variable_path(@project.namespace, @project, variable), class: "btn btn-transparent btn-variable-edit" do
%span.sr-only %span.sr-only
Update Update
= icon("pencil") = icon("pencil")
= link_to namespace_project_variable_path(@project.namespace, @project, variable), class: "btn btn-transparent", method: :delete, data: { confirm: "Are you sure?" } do = link_to namespace_project_variable_path(@project.namespace, @project, variable), class: "btn btn-transparent btn-variable-delete", method: :delete, data: { confirm: "Are you sure?" } do
%span.sr-only %span.sr-only
Remove Remove
= icon("trash") = icon("trash")
require 'spec_helper' require 'spec_helper'
   
describe "Variables" do describe 'Project variables', js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
before { login_as(user) } let(:project) { create(:project) }
let(:variable) { create(:ci_variable, key: 'test') }
describe "specific runners" do
before do before do
@project = FactoryGirl.create :empty_project login_as(user)
@project.team << [user, :master] project.team << [user, :master]
project.variables << variable
visit namespace_project_variables_path(project.namespace, project)
end
it 'should show list of variables' do
page.within('.variables-table') do
expect(page).to have_content(variable.key)
end
end
it 'should add new variable' do
fill_in('variable_key', with: 'key')
fill_in('variable_value', with: 'key value')
click_button('Add new variable')
page.within('.variables-table') do
expect(page).to have_content('key')
end
end
it 'should delete variable' do
page.within('.variables-table') do
find('.btn-variable-delete').click
end
expect(page).to_not have_selector('variables-table')
end
it 'should edit variable' do
page.within('.variables-table') do
find('.btn-variable-edit').click
end end
   
it "creates variable", js: true do fill_in('variable_key', with: 'key')
visit namespace_project_variables_path(@project.namespace, @project) fill_in('variable_value', with: 'key value')
click_on "Add a variable" click_button('Save variable')
fill_in "Key", with: "SECRET_KEY"
fill_in "Value", with: "SECRET_VALUE"
click_on "Save changes"
   
expect(page).to have_content("Variables were successfully updated.") page.within('.variables-table') do
expect(@project.variables.count).to eq(1) expect(page).to have_content('key')
end end
end end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment