Add a new stub_mattermost_setting stub helper to properly stub Mattermost settings

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2017-03-28 14:12:32 +02:00
parent ad831ace7e
commit db8a8afc61
No known key found for this signature in database
GPG key ID: 46DF07E5CD9E96AB
4 changed files with 7 additions and 3 deletions

View file

@ -46,7 +46,7 @@ feature 'Group', feature: true do
describe 'Mattermost team creation' do
before do
allow(Settings.mattermost).to receive_messages(enabled: mattermost_enabled)
stub_mattermost_setting(enabled: mattermost_enabled)
visit new_group_path
end

View file

@ -7,7 +7,7 @@ feature 'Setup Mattermost slash commands', :feature, :js do
let(:mattermost_enabled) { true }
before do
Settings.mattermost['enabled'] = mattermost_enabled
stub_mattermost_setting(enabled: mattermost_enabled)
project.team << [user, :master]
login_as(user)
visit edit_namespace_project_service_path(project.namespace, project, service)

View file

@ -44,7 +44,7 @@ describe Groups::CreateService, '#execute', services: true do
let!(:service) { described_class.new(user, params) }
before do
Settings.mattermost['enabled'] = true
stub_mattermost_setting(enabled: true)
end
it 'create the chat team with the group' do

View file

@ -21,6 +21,10 @@ module StubConfiguration
allow(Gitlab.config.incoming_email).to receive_messages(messages)
end
def stub_mattermost_setting(messages)
allow(Gitlab.config.mattermost).to receive_messages(messages)
end
private
# Modifies stubbed messages to also stub possible predicate versions