summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-11-05 16:22:37 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2015-11-08 23:55:47 +0100
commit4fda9ef8a522352886fad08524b4ad4054a7eb60 (patch)
treefa2346f9e73c4fa49b1fbf9ccf24e5fa63f3219d
parentb18671a1b2c565a87663544441000063f6b83c8e (diff)
downloadgitlab-ce-shared_runners.tar.gz
-rw-r--r--spec/factories/ci/projects.rb2
-rw-r--r--spec/models/application_setting_spec.rb28
-rw-r--r--spec/services/ci/register_build_service_spec.rb4
3 files changed, 31 insertions, 3 deletions
diff --git a/spec/factories/ci/projects.rb b/spec/factories/ci/projects.rb
index 111e1a82816..1183a190353 100644
--- a/spec/factories/ci/projects.rb
+++ b/spec/factories/ci/projects.rb
@@ -33,6 +33,8 @@ FactoryGirl.define do
gl_project factory: :empty_project
+ shared_runners_enabled false
+
factory :ci_project do
token 'iPWx6WM4lhHNedGfBpPJNP'
end
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index de0b2ef4cda..f01fe8bd398 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -28,11 +28,11 @@
require 'spec_helper'
describe ApplicationSetting, models: true do
- it { expect(ApplicationSetting.create_from_defaults).to be_valid }
+ let(:setting) { ApplicationSetting.create_from_defaults }
- context 'restricted signup domains' do
- let(:setting) { ApplicationSetting.create_from_defaults }
+ it { expect(setting).to be_valid }
+ context 'restricted signup domains' do
it 'set single domain' do
setting.restricted_signup_domains_raw = 'example.com'
expect(setting.restricted_signup_domains).to eq(['example.com'])
@@ -53,4 +53,26 @@ describe ApplicationSetting, models: true do
expect(setting.restricted_signup_domains).to eq(['example.com', '*.example.com'])
end
end
+
+ context 'shared runners' do
+ let(:gl_project) { create(:empty_project) }
+
+ before do
+ allow_any_instance_of(Project).to receive(:current_application_settings).and_return(setting)
+ end
+
+ subject { gl_project.ensure_gitlab_ci_project.shared_runners_enabled }
+
+ context 'enabled' do
+ before { setting.update_attributes(shared_runners_enabled: true) }
+
+ it { is_expected.to be_truthy }
+ end
+
+ context 'disabled' do
+ before { setting.update_attributes(shared_runners_enabled: false) }
+
+ it { is_expected.to be_falsey }
+ end
+ end
end
diff --git a/spec/services/ci/register_build_service_spec.rb b/spec/services/ci/register_build_service_spec.rb
index 781764627ac..b370dfbe113 100644
--- a/spec/services/ci/register_build_service_spec.rb
+++ b/spec/services/ci/register_build_service_spec.rb
@@ -70,6 +70,10 @@ module Ci
end
context 'disallow shared runners' do
+ before do
+ gl_project.gitlab_ci_project.update(shared_runners_enabled: false)
+ end
+
context 'shared runner' do
let(:build) { service.execute(shared_runner) }