summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2015-12-22 08:47:23 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2015-12-22 08:47:23 +0100
commitaff713988bb9fe5b1d35f1986f44b5c1af5a5979 (patch)
treeb85c2c5177385b2d733bb092433eda85290633a9
parent25bf3eb8041be93d9003d2cac1323f4d18d317ec (diff)
downloadgitlab-ce-aff713988bb9fe5b1d35f1986f44b5c1af5a5979.tar.gz
Improve CI Lint specs (refactoring)
-rw-r--r--spec/features/lint_spec.rb47
1 files changed, 29 insertions, 18 deletions
diff --git a/spec/features/lint_spec.rb b/spec/features/lint_spec.rb
index 5d8f56e2cfb..441a3c702c7 100644
--- a/spec/features/lint_spec.rb
+++ b/spec/features/lint_spec.rb
@@ -1,28 +1,39 @@
require 'spec_helper'
-describe "Lint" do
+describe 'CI Lint' do
before do
login_as :user
end
- it "Yaml parsing", js: true do
- content = File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
- visit ci_lint_path
- fill_in "content", with: content
- click_on "Validate"
- within "table" do
- expect(page).to have_content("Job - rspec")
- expect(page).to have_content("Job - spinach")
- expect(page).to have_content("Deploy Job - staging")
- expect(page).to have_content("Deploy Job - production")
+ describe 'YAML parsing', js: true do
+ before do
+ visit ci_lint_path
+ fill_in 'content', with: yaml_content
+ click_on 'Validate'
end
- end
- it "Yaml parsing with error", js: true do
- visit ci_lint_path
- fill_in "content", with: ""
- click_on "Validate"
- expect(page).to have_content("Status: syntax is incorrect")
- expect(page).to have_content("Error: Please provide content of .gitlab-ci.yml")
+ context 'YAML is correct' do
+ let(:yaml_content) do
+ File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
+ end
+
+ it 'Yaml parsing' do
+ within "table" do
+ expect(page).to have_content('Job - rspec')
+ expect(page).to have_content('Job - spinach')
+ expect(page).to have_content('Deploy Job - staging')
+ expect(page).to have_content('Deploy Job - production')
+ end
+ end
+ end
+
+ context 'YAML is incorrect' do
+ let(:yaml_content) { '' }
+
+ it 'displays information about an error' do
+ expect(page).to have_content('Status: syntax is incorrect')
+ expect(page).to have_content('Error: Please provide content of .gitlab-ci.yml')
+ end
+ end
end
end