2017-08-24 07:01:33 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-04 09:44:46 -04:00
|
|
|
describe ProjectAutoDevops do
|
2017-09-06 15:00:34 -04:00
|
|
|
set(:project) { build(:project) }
|
2017-08-24 07:01:33 -04:00
|
|
|
|
|
|
|
it { is_expected.to belong_to(:project) }
|
|
|
|
|
|
|
|
it { is_expected.to respond_to(:created_at) }
|
|
|
|
it { is_expected.to respond_to(:updated_at) }
|
|
|
|
|
2017-09-16 09:02:37 -04:00
|
|
|
describe '#has_domain?' do
|
2017-09-19 09:56:44 -04:00
|
|
|
context 'when domain is defined' do
|
|
|
|
let(:auto_devops) { build_stubbed(:project_auto_devops, project: project, domain: 'domain.com') }
|
|
|
|
|
|
|
|
it { expect(auto_devops).to have_domain }
|
|
|
|
end
|
2017-09-16 09:02:37 -04:00
|
|
|
|
2017-09-19 09:56:44 -04:00
|
|
|
context 'when domain is empty' do
|
|
|
|
let(:auto_devops) { build_stubbed(:project_auto_devops, project: project, domain: '') }
|
|
|
|
|
|
|
|
it { expect(auto_devops).not_to have_domain }
|
|
|
|
end
|
2017-09-16 09:02:37 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe '#variables' do
|
2017-09-06 15:00:34 -04:00
|
|
|
let(:auto_devops) { build_stubbed(:project_auto_devops, project: project, domain: domain) }
|
|
|
|
|
|
|
|
context 'when domain is defined' do
|
|
|
|
let(:domain) { 'example.com' }
|
|
|
|
|
|
|
|
it 'returns AUTO_DEVOPS_DOMAIN' do
|
|
|
|
expect(auto_devops.variables).to include(
|
|
|
|
{ key: 'AUTO_DEVOPS_DOMAIN', value: 'example.com', public: true })
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-08-24 07:01:33 -04:00
|
|
|
end
|