summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-08-23 21:58:45 +0900
committerShinya Maeda <shinya@gitlab.com>2017-08-23 21:58:45 +0900
commitfab3df77cf72126f4fad95dc558fb5bf46fd20e0 (patch)
tree0216901f0dd3e73f0484861c2d640e3777f85080
parent438e18d8093afc31626408bb76954a7d9e635bbd (diff)
downloadgitlab-ce-fix/sm/36731-improve-spec-spec-features-runners_spec-rb-and-spec-features-admin-admin_runners_spec-rb.tar.gz
-rw-r--r--spec/features/runners_spec.rb61
1 files changed, 32 insertions, 29 deletions
diff --git a/spec/features/runners_spec.rb b/spec/features/runners_spec.rb
index 4f87dbe392d..785cfeb34bd 100644
--- a/spec/features/runners_spec.rb
+++ b/spec/features/runners_spec.rb
@@ -10,11 +10,14 @@ feature 'Runners' do
context 'when a project has enabled shared_runners' do
given(:project) { create(:project) }
+ background do
+ project.add_master(user)
+ end
+
context 'when a specific runner is activated on the project' do
given(:specific_runner) { create(:ci_runner, :specific) }
background do
- project.add_master(user)
project.runners << specific_runner
end
@@ -30,19 +33,19 @@ feature 'Runners' do
expect(page).to have_content(specific_runner.platform)
end
- scenario 'user removes an activated specific runner' do
+ scenario 'user removes an activated specific runner if this is last project for that runners' do
visit runners_path(project)
within '.activated-specific-runners' do
click_on 'Remove Runner'
end
- expect(page).to have_no_css('.activated-specific-runners')
+ expect(page).not_to have_content(specific_runner.display_name)
end
context 'when a runner has a tag' do
background do
- specific_runner.update_attribute(:tag_list, ['tag'])
+ specific_runner.update(tag_list: ['tag'])
end
scenario 'user edits runner not to run untagged jobs' do
@@ -61,40 +64,40 @@ feature 'Runners' do
end
end
- context 'when a specific runner exists in another project' do
- given(:another_project) { create(:project) }
- given(:specific_runner2) { create(:ci_runner, :specific) }
-
- background do
- another_project.add_master(user)
- another_project.runners << specific_runner2
- end
+ context 'when a shared runner is activated on the project' do
+ given!(:shared_runner) { create(:ci_runner, :shared) }
- scenario 'user enables and disables a specific runner' do
+ scenario 'user sees CI/CD setting page' do
visit runners_path(project)
- within '.available-specific-runners' do
- click_on 'Enable for this project'
- end
-
- expect(page.find('.activated-specific-runners')).to have_content(specific_runner2.display_name)
+ expect(page.find('.available-shared-runners')).to have_content(shared_runner.display_name)
+ end
+ end
+ end
- within '.activated-specific-runners' do
- click_on 'Disable for this project'
- end
+ context 'when a specific runner exists in another project' do
+ given(:another_project) { create(:project) }
+ given(:specific_runner) { create(:ci_runner, :specific) }
- expect(page.find('.activated-specific-runners')).not_to have_content(specific_runner2.display_name)
- end
+ background do
+ another_project.add_master(user)
+ another_project.runners << specific_runner
end
- context 'when a shared runner is activated on the project' do
- given!(:shared_runner) { create(:ci_runner, :shared) }
+ scenario 'user enables and disables a specific runner' do
+ visit runners_path(project)
- scenario 'user sees CI/CD setting page' do
- visit runners_path(project)
+ within '.available-specific-runners' do
+ click_on 'Enable for this project'
+ end
- expect(page.find('.available-shared-runners')).to have_content(shared_runner.display_name)
+ expect(page.find('.activated-specific-runners')).to have_content(specific_runner.display_name)
+
+ within '.activated-specific-runners' do
+ click_on 'Disable for this project'
end
+
+ expect(page.find('.available-specific-runners')).to have_content(specific_runner.display_name)
end
end
@@ -103,7 +106,6 @@ feature 'Runners' do
given(:shared_runners_html) { 'custom shared runners description' }
background do
- project.add_master(user)
stub_application_setting(shared_runners_text: shared_runners_text)
end
@@ -126,6 +128,7 @@ feature 'Runners' do
visit runners_path(project)
click_on 'Enable shared Runners'
+
expect(page.find('.shared-runners-description')).to have_content('Disable shared Runners')
end
end