Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/integrations/base_chat_notification_spec.rb')
-rw-r--r--spec/models/integrations/base_chat_notification_spec.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/spec/models/integrations/base_chat_notification_spec.rb b/spec/models/integrations/base_chat_notification_spec.rb
index eb503e501d6..b959ead2cae 100644
--- a/spec/models/integrations/base_chat_notification_spec.rb
+++ b/spec/models/integrations/base_chat_notification_spec.rb
@@ -3,11 +3,15 @@
require 'spec_helper'
RSpec.describe Integrations::BaseChatNotification do
+ describe 'default values' do
+ it { expect(subject.category).to eq(:chat) }
+ end
+
describe 'validations' do
before do
allow(subject).to receive(:activated?).and_return(true)
allow(subject).to receive(:default_channel_placeholder).and_return('placeholder')
- allow(subject).to receive(:webhook_placeholder).and_return('placeholder')
+ allow(subject).to receive(:webhook_help).and_return('help')
end
it { is_expected.to validate_presence_of :webhook }
@@ -19,7 +23,7 @@ RSpec.describe Integrations::BaseChatNotification do
let_it_be(:project) { create(:project, :repository) }
- let(:user) { create(:user) }
+ let(:user) { build_stubbed(:user) }
let(:webhook_url) { 'https://example.gitlab.com/' }
let(:data) { Gitlab::DataBuilder::Push.build_sample(subject.project, user) }
@@ -44,7 +48,7 @@ RSpec.describe Integrations::BaseChatNotification do
context 'with an empty repository' do
it 'returns true' do
- subject.project = create(:project, :empty_repo)
+ subject.project = build_stubbed(:project, :empty_repo)
expect(chat_integration).to receive(:notify).and_return(true)
expect(chat_integration.execute(data)).to be true
@@ -61,9 +65,9 @@ RSpec.describe Integrations::BaseChatNotification do
end
context 'when the data object has a label' do
- let_it_be(:label) { create(:label, name: 'Bug') }
- let_it_be(:label_2) { create(:label, name: 'Community contribution') }
- let_it_be(:label_3) { create(:label, name: 'Backend') }
+ let_it_be(:label) { create(:label, project: project, name: 'Bug') }
+ let_it_be(:label_2) { create(:label, project: project, name: 'Community contribution') }
+ let_it_be(:label_3) { create(:label, project: project, name: 'Backend') }
let_it_be(:issue) { create(:labeled_issue, project: project, labels: [label, label_2, label_3]) }
let_it_be(:note) { create(:note, noteable: issue, project: project) }
@@ -93,7 +97,7 @@ RSpec.describe Integrations::BaseChatNotification do
it_behaves_like 'notifies the chat integration'
context 'MergeRequest events' do
- let(:data) { create(:merge_request, labels: [label]).to_hook_data(user) }
+ let(:data) { build_stubbed(:merge_request, source_project: project, labels: [label]).to_hook_data(user) }
it_behaves_like 'notifies the chat integration'
end
@@ -280,9 +284,9 @@ RSpec.describe Integrations::BaseChatNotification do
end
end
- describe '#webhook_placeholder' do
+ describe '#webhook_help' do
it 'raises an error' do
- expect { subject.webhook_placeholder }.to raise_error(NotImplementedError)
+ expect { subject.webhook_help }.to raise_error(NotImplementedError)
end
end