Commit 4fda9ef8 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix tests

parent b18671a1
...@@ -33,6 +33,8 @@ FactoryGirl.define do ...@@ -33,6 +33,8 @@ FactoryGirl.define do
gl_project factory: :empty_project gl_project factory: :empty_project
shared_runners_enabled false
factory :ci_project do factory :ci_project do
token 'iPWx6WM4lhHNedGfBpPJNP' token 'iPWx6WM4lhHNedGfBpPJNP'
end end
......
...@@ -28,11 +28,11 @@ ...@@ -28,11 +28,11 @@
require 'spec_helper' require 'spec_helper'
describe ApplicationSetting, models: true do 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 it { expect(setting).to be_valid }
let(:setting) { ApplicationSetting.create_from_defaults }
context 'restricted signup domains' do
it 'set single domain' do it 'set single domain' do
setting.restricted_signup_domains_raw = 'example.com' setting.restricted_signup_domains_raw = 'example.com'
expect(setting.restricted_signup_domains).to eq(['example.com']) expect(setting.restricted_signup_domains).to eq(['example.com'])
...@@ -53,4 +53,26 @@ describe ApplicationSetting, models: true do ...@@ -53,4 +53,26 @@ describe ApplicationSetting, models: true do
expect(setting.restricted_signup_domains).to eq(['example.com', '*.example.com']) expect(setting.restricted_signup_domains).to eq(['example.com', '*.example.com'])
end end
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 end
...@@ -70,6 +70,10 @@ module Ci ...@@ -70,6 +70,10 @@ module Ci
end end
context 'disallow shared runners' do context 'disallow shared runners' do
before do
gl_project.gitlab_ci_project.update(shared_runners_enabled: false)
end
context 'shared runner' do context 'shared runner' do
let(:build) { service.execute(shared_runner) } let(:build) { service.execute(shared_runner) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment