diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-23 03:11:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-23 03:11:14 +0300 |
commit | 7be5d1ceaf8aeed82584e3b28d48221bbf86a7e6 (patch) | |
tree | d7d3708eb09d4c14f46dff2182bd0e925d21a636 /spec/models | |
parent | f452b65f436f0c56488256db52cf1681b94b3dea (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/project_spec.rb | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index d8f3a63d221..501f36c5107 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -1257,19 +1257,19 @@ RSpec.describe Project, factory_default: :keep do end it 'returns an active external wiki' do - create(:service, project: project, type: 'ExternalWikiService', active: true) + create(:external_wiki_integration, project: project, active: true) is_expected.to be_kind_of(Integrations::ExternalWiki) end it 'does not return an inactive external wiki' do - create(:service, project: project, type: 'ExternalWikiService', active: false) + create(:external_wiki_integration, project: project, active: false) is_expected.to eq(nil) end it 'sets Project#has_external_wiki when it is nil' do - create(:service, project: project, type: 'ExternalWikiService', active: true) + create(:external_wiki_integration, project: project, active: true) project.update_column(:has_external_wiki, nil) expect { subject }.to change { project.has_external_wiki }.from(nil).to(true) @@ -1279,36 +1279,40 @@ RSpec.describe Project, factory_default: :keep do describe '#has_external_wiki' do let_it_be(:project) { create(:project) } - def subject + def has_external_wiki project.reload.has_external_wiki end - specify { is_expected.to eq(false) } + specify { expect(has_external_wiki).to eq(false) } - context 'when there is an active external wiki service' do - let!(:service) do - create(:service, project: project, type: 'ExternalWikiService', active: true) + context 'when there is an active external wiki integration' do + let(:active) { true } + + let!(:integration) do + create(:external_wiki_integration, project: project, active: active) end - specify { is_expected.to eq(true) } + specify { expect(has_external_wiki).to eq(true) } it 'becomes false if the external wiki service is destroyed' do expect do - Integration.find(service.id).delete - end.to change { subject }.to(false) + Integration.find(integration.id).delete + end.to change { has_external_wiki }.to(false) end it 'becomes false if the external wiki service becomes inactive' do expect do - service.update_column(:active, false) - end.to change { subject }.to(false) + integration.update_column(:active, false) + end.to change { has_external_wiki }.to(false) end - end - it 'is false when external wiki service is not active' do - create(:service, project: project, type: 'ExternalWikiService', active: false) + context 'when created as inactive' do + let(:active) { false } - is_expected.to eq(false) + it 'is false' do + expect(has_external_wiki).to eq(false) + end + end end end |