Commit 5a9ede47 authored by Robert Speicher's avatar Robert Speicher Committed by Dmitriy Zaporozhets

Update mock and stub syntax for specs

parent dad88568
module BroadcastMessagesHelper
def broadcast_styling(broadcast_message)
if(broadcast_message.color || broadcast_message.font)
"background-color:#{broadcast_message.color};color:#{broadcast_message.font}"
else
""
styling = ''
if broadcast_message.color.present?
styling << "background-color: #{broadcast_message.color}"
styling << '; ' if broadcast_message.font.present?
end
if broadcast_message.font.present?
styling << "color: #{broadcast_message.font}"
end
styling
end
end
module IconsHelper
include FontAwesome::Rails::IconHelper
# Creates an icon tag given icon name(s) and possible icon modifiers.
#
# Right now this method simply delegates directly to `fa_icon` from the
......
module NotificationsHelper
include IconsHelper
def notification_icon(notification)
if notification.disabled?
icon('volume-off', class: 'ns-mute')
......
......@@ -16,7 +16,7 @@ describe AutocompleteController do
let(:body) { JSON.parse(response.body) }
it { expect(body).to be_kind_of(Array) }
it { expect(body.size).to eq(1) }
it { expect(body.size).to eq 1 }
it { expect(body.first["username"]).to eq user.username }
end
......@@ -33,7 +33,7 @@ describe AutocompleteController do
let(:body) { JSON.parse(response.body) }
it { expect(body).to be_kind_of(Array) }
it { expect(body.size).to eq(1) }
it { expect(body.size).to eq 1 }
it { expect(body.first["username"]).to eq user.username }
end
......@@ -46,6 +46,6 @@ describe AutocompleteController do
let(:body) { JSON.parse(response.body) }
it { expect(body).to be_kind_of(Array) }
it { expect(body.size).to eq(User.count) }
it { expect(body.size).to eq User.count }
end
end
......@@ -11,7 +11,8 @@ describe "GitLab Flavored Markdown", feature: true do
end
before do
Commit.any_instance.stub(title: "fix #{issue.to_reference}\n\nask #{fred.to_reference} for details")
allow_any_instance_of(Commit).to receive(:title).
and_return("fix #{issue.to_reference}\n\nask #{fred.to_reference} for details")
end
let(:commit) { project.commit }
......
......@@ -9,7 +9,8 @@ describe 'Profile account page', feature: true do
describe 'when signup is enabled' do
before do
ApplicationSetting.any_instance.stub(signup_enabled?: true)
allow_any_instance_of(ApplicationSetting).
to receive(:signup_enabled?).and_return(true)
visit profile_account_path
end
......@@ -23,7 +24,8 @@ describe 'Profile account page', feature: true do
describe 'when signup is disabled' do
before do
ApplicationSetting.any_instance.stub(signup_enabled?: false)
allow_any_instance_of(ApplicationSetting).
to receive(:signup_enabled?).and_return(false)
visit profile_account_path
end
......
......@@ -76,8 +76,8 @@ describe ApplicationHelper do
end
it 'should return an url for the avatar with relative url' do
Gitlab.config.gitlab.stub(relative_url_root: '/gitlab')
Gitlab.config.gitlab.stub(url: Settings.send(:build_gitlab_url))
allow(Gitlab.config.gitlab).to receive(:relative_url_root).and_return('/gitlab')
allow(Gitlab.config.gitlab).to receive(:url).and_return(Settings.send(:build_gitlab_url))
user = create(:user)
user.avatar = File.open(avatar_file_path)
......@@ -97,7 +97,7 @@ describe ApplicationHelper do
let(:user_email) { 'user@email.com' }
it 'should return a generic avatar path when Gravatar is disabled' do
ApplicationSetting.any_instance.stub(gravatar_enabled?: false)
allow_any_instance_of(ApplicationSetting).to receive(:gravatar_enabled?).and_return(false)
expect(gravatar_icon(user_email)).to match('no_avatar.png')
end
......@@ -106,13 +106,13 @@ describe ApplicationHelper do
end
it 'should return default gravatar url' do
Gitlab.config.gitlab.stub(https: false)
allow(Gitlab.config.gitlab).to receive(:https).and_return(false)
url = 'http://www.gravatar.com/avatar/b58c6f14d292556214bd64909bcdb118'
expect(gravatar_icon(user_email)).to match(url)
end
it 'should use SSL when appropriate' do
Gitlab.config.gitlab.stub(https: true)
allow(Gitlab.config.gitlab).to receive(:https).and_return(true)
expect(gravatar_icon(user_email)).to match('https://secure.gravatar.com')
end
......
......@@ -2,20 +2,20 @@ require 'spec_helper'
describe BroadcastMessagesHelper do
describe 'broadcast_styling' do
let(:broadcast_message) { double(color: "", font: "") }
let(:broadcast_message) { double(color: '', font: '') }
context "default style" do
it "should have no style" do
expect(broadcast_styling(broadcast_message)).to match('')
expect(broadcast_styling(broadcast_message)).to eq ''
end
end
context "customiezd style" do
before { broadcast_message.stub(color: "#f2dede", font: "#b94a48") }
context "customized style" do
let(:broadcast_message) { double(color: "#f2dede", font: '#b94a48') }
it "should have a customized style" do
expect(broadcast_styling(broadcast_message)).
to match('background-color:#f2dede;color:#b94a48')
to match('background-color: #f2dede; color: #b94a48')
end
end
end
......
......@@ -48,19 +48,19 @@ describe DiffHelper do
end
it 'should return only the first file if the diff line count in the 2nd file takes the total beyond safe limits' do
diffs[1].diff.stub(lines: [""] * 4999) #simulate 4999 lines
allow(diffs[1].diff).to receive(:lines).and_return([""] * 4999) #simulate 4999 lines
expect(safe_diff_files(diffs).length).to eq(1)
end
it 'should return all files from a commit that is beyond safe limit for numbers of lines if force diff is true' do
allow(controller).to receive(:params) { { force_show_diff: true } }
diffs[1].diff.stub(lines: [""] * 4999) #simulate 4999 lines
allow(diffs[1].diff).to receive(:lines).and_return([""] * 4999) #simulate 4999 lines
expect(safe_diff_files(diffs).length).to eq(2)
end
it 'should return only the first file if the diff line count in the 2nd file takes the total beyond hard limits' do
allow(controller).to receive(:params) { { force_show_diff: true } }
diffs[1].diff.stub(lines: [""] * 49999) #simulate 49999 lines
allow(diffs[1].diff).to receive(:lines).and_return([""] * 49999) #simulate 49999 lines
expect(safe_diff_files(diffs).length).to eq(1)
end
......
require 'spec_helper'
describe NotificationsHelper do
include FontAwesome::Rails::IconHelper
include IconsHelper
describe 'notification_icon' do
let(:notification) { double(disabled?: false, participating?: false, watch?: false) }
context "disabled notification" do
before { notification.stub(disabled?: true) }
before { allow(notification).to receive(:disabled?).and_return(true) }
it "has a red icon" do
expect(notification_icon(notification)).to match('class="fa fa-volume-off ns-mute"')
......@@ -16,7 +13,7 @@ describe NotificationsHelper do
end
context "participating notification" do
before { notification.stub(participating?: true) }
before { allow(notification).to receive(:participating?).and_return(true) }
it "has a blue icon" do
expect(notification_icon(notification)).to match('class="fa fa-volume-down ns-part"')
......@@ -24,7 +21,7 @@ describe NotificationsHelper do
end
context "watched notification" do
before { notification.stub(watch?: true) }
before { allow(notification).to receive(:watch?).and_return(true) }
it "has a green icon" do
expect(notification_icon(notification)).to match('class="fa fa-volume-up ns-watch"')
......
......@@ -14,41 +14,41 @@ describe SubmoduleHelper do
context 'submodule on self' do
before do
Gitlab.config.gitlab.stub(protocol: 'http') # set this just to be sure
allow(Gitlab.config.gitlab).to receive(:protocol).and_return('http') # set this just to be sure
end
it 'should detect ssh on standard port' do
Gitlab.config.gitlab_shell.stub(ssh_port: 22) # set this just to be sure
Gitlab.config.gitlab_shell.stub(ssh_path_prefix: Settings.send(:build_gitlab_shell_ssh_path_prefix))
allow(Gitlab.config.gitlab_shell).to receive(:ssh_port).and_return(22) # set this just to be sure
allow(Gitlab.config.gitlab_shell).to receive(:ssh_path_prefix).and_return(Settings.send(:build_gitlab_shell_ssh_path_prefix))
stub_url([ config.user, '@', config.host, ':gitlab-org/gitlab-ce.git' ].join(''))
expect(submodule_links(submodule_item)).to eq([ namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash') ])
end
it 'should detect ssh on non-standard port' do
Gitlab.config.gitlab_shell.stub(ssh_port: 2222)
Gitlab.config.gitlab_shell.stub(ssh_path_prefix: Settings.send(:build_gitlab_shell_ssh_path_prefix))
allow(Gitlab.config.gitlab_shell).to receive(:ssh_port).and_return(2222)
allow(Gitlab.config.gitlab_shell).to receive(:ssh_path_prefix).and_return(Settings.send(:build_gitlab_shell_ssh_path_prefix))
stub_url([ 'ssh://', config.user, '@', config.host, ':2222/gitlab-org/gitlab-ce.git' ].join(''))
expect(submodule_links(submodule_item)).to eq([ namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash') ])
end
it 'should detect http on standard port' do
Gitlab.config.gitlab.stub(port: 80)
Gitlab.config.gitlab.stub(url: Settings.send(:build_gitlab_url))
allow(Gitlab.config.gitlab).to receive(:port).and_return(80)
allow(Gitlab.config.gitlab).to receive(:url).and_return(Settings.send(:build_gitlab_url))
stub_url([ 'http://', config.host, '/gitlab-org/gitlab-ce.git' ].join(''))
expect(submodule_links(submodule_item)).to eq([ namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash') ])
end
it 'should detect http on non-standard port' do
Gitlab.config.gitlab.stub(port: 3000)
Gitlab.config.gitlab.stub(url: Settings.send(:build_gitlab_url))
allow(Gitlab.config.gitlab).to receive(:port).and_return(3000)
allow(Gitlab.config.gitlab).to receive(:url).and_return(Settings.send(:build_gitlab_url))
stub_url([ 'http://', config.host, ':3000/gitlab-org/gitlab-ce.git' ].join(''))
expect(submodule_links(submodule_item)).to eq([ namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash') ])
end
it 'should work with relative_url_root' do
Gitlab.config.gitlab.stub(port: 80) # set this just to be sure
Gitlab.config.gitlab.stub(relative_url_root: '/gitlab/root')
Gitlab.config.gitlab.stub(url: Settings.send(:build_gitlab_url))
allow(Gitlab.config.gitlab).to receive(:port).and_return(80) # set this just to be sure
allow(Gitlab.config.gitlab).to receive(:relative_url_root).and_return('/gitlab/root')
allow(Gitlab.config.gitlab).to receive(:url).and_return(Settings.send(:build_gitlab_url))
stub_url([ 'http://', config.host, '/gitlab/root/gitlab-org/gitlab-ce.git' ].join(''))
expect(submodule_links(submodule_item)).to eq([ namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash') ])
end
......@@ -156,6 +156,6 @@ describe SubmoduleHelper do
end
def stub_url(url)
repo.stub(submodule_url_for: url)
allow(repo).to receive(:submodule_url_for).and_return(url)
end
end
......@@ -9,8 +9,11 @@ describe ExtractsPath do
before do
@project = project
project.stub(repository: double(ref_names: ['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0']))
project.stub(path_with_namespace: 'gitlab/gitlab-ci')
repo = double(ref_names: ['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0'])
allow(project).to receive(:repository).and_return(repo)
allow(project).to receive(:path_with_namespace).
and_return('gitlab/gitlab-ci')
end
describe '#assign_ref' do
......
......@@ -36,7 +36,9 @@ describe Gitlab::Auth do
end
context "with ldap enabled" do
before { Gitlab::LDAP::Config.stub(enabled?: true) }
before do
allow(Gitlab::LDAP::Config).to receive(:enabled?).and_return(true)
end
it "tries to autheticate with db before ldap" do
expect(Gitlab::LDAP::Authentication).not_to receive(:login)
......
......@@ -5,7 +5,7 @@ describe Gitlab::Shell do
let(:gitlab_shell) { Gitlab::Shell.new }
before do
Project.stub(find: project)
allow(Project).to receive(:find).and_return(project)
end
it { is_expected.to respond_to :add_key }
......
......@@ -8,16 +8,24 @@ describe Gitlab::LDAP::Access do
subject { access.allowed? }
context 'when the user cannot be found' do
before { Gitlab::LDAP::Person.stub(find_by_dn: nil) }
before do
allow(Gitlab::LDAP::Person).to receive(:find_by_dn).and_return(nil)
end
it { is_expected.to be_falsey }
end
context 'when the user is found' do
before { Gitlab::LDAP::Person.stub(find_by_dn: :ldap_user) }
before do
allow(Gitlab::LDAP::Person).
to receive(:find_by_dn).and_return(:ldap_user)
end
context 'and the user is disabled via active directory' do
before { Gitlab::LDAP::Person.stub(disabled_via_active_directory?: true) }
before do
allow(Gitlab::LDAP::Person).
to receive(:disabled_via_active_directory?).and_return(true)
end
it { is_expected.to be_falsey }
......@@ -30,8 +38,9 @@ describe Gitlab::LDAP::Access do
context 'and has no disabled flag in active diretory' do
before do
user.block
Gitlab::LDAP::Person.stub(disabled_via_active_directory?: false)
allow(Gitlab::LDAP::Person).
to receive(:disabled_via_active_directory?).and_return(false)
end
it { is_expected.to be_truthy }
......@@ -39,7 +48,8 @@ describe Gitlab::LDAP::Access do
context 'when auto-created users are blocked' do
before do
Gitlab::LDAP::Config.any_instance.stub(block_auto_created_users: true)
allow_any_instance_of(Gitlab::LDAP::Config).
to receive(:block_auto_created_users).and_return(true)
end
it "does not unblock user in GitLab" do
......@@ -51,7 +61,8 @@ describe Gitlab::LDAP::Access do
context "when auto-created users are not blocked" do
before do
Gitlab::LDAP::Config.any_instance.stub(block_auto_created_users: false)
allow_any_instance_of(Gitlab::LDAP::Config).
to receive(:block_auto_created_users).and_return(false)
end
it "should unblock user in GitLab" do
......@@ -63,8 +74,9 @@ describe Gitlab::LDAP::Access do
context 'without ActiveDirectory enabled' do
before do
Gitlab::LDAP::Config.stub(enabled?: true)
Gitlab::LDAP::Config.any_instance.stub(active_directory: false)
allow(Gitlab::LDAP::Config).to receive(:enabled?).and_return(true)
allow_any_instance_of(Gitlab::LDAP::Config).
to receive(:active_directory).and_return(false)
end
it { is_expected.to be_truthy }
......
......@@ -3,27 +3,32 @@ require 'spec_helper'
describe Gitlab::LDAP::Adapter do
let(:adapter) { Gitlab::LDAP::Adapter.new 'ldapmain' }
describe :dn_matches_filter? do
describe '#dn_matches_filter?' do
let(:ldap) { double(:ldap) }
subject { adapter.dn_matches_filter?(:dn, :filter) }
before { adapter.stub(ldap: ldap) }
before { allow(adapter).to receive(:ldap).and_return(ldap) }
context "when the search is successful" do
context "and the result is non-empty" do
before { ldap.stub(search: [:foo]) }
before { allow(ldap).to receive(:search).and_return([:foo]) }
it { is_expected.to be_truthy }
end
context "and the result is empty" do
before { ldap.stub(search: []) }
before { allow(ldap).to receive(:search).and_return([]) }
it { is_expected.to be_falsey }
end
end
context "when the search encounters an error" do
before { ldap.stub(search: nil, get_operation_result: double(code: 1, message: 'some error')) }
before do
allow(ldap).to receive_messages(
search: nil,
get_operation_result: double(code: 1, message: 'some error')
)
end
it { is_expected.to be_falsey }
end
......
require 'spec_helper'
describe Gitlab::LDAP::Authentication do
let(:klass) { Gitlab::LDAP::Authentication }
let(:user) { create(:omniauth_user, extern_uid: dn) }
let(:dn) { 'uid=john,ou=people,dc=example,dc=com' }
let(:login) { 'john' }
let(:user) { create(:omniauth_user, extern_uid: dn) }
let(:dn) { 'uid=john,ou=people,dc=example,dc=com' }
let(:login) { 'john' }
let(:password) { 'password' }
describe :login do
let(:adapter) { double :adapter }
describe 'login' do
before do
Gitlab::LDAP::Config.stub(enabled?: true)
allow(Gitlab::LDAP::Config).to receive(:enabled?).and_return(true)
end
it "finds the user if authentication is successful" do
user
expect(user).not_to be_nil
# try only to fake the LDAP call
klass.any_instance.stub(adapter: double(:adapter,
bind_as: double(:ldap_user, dn: dn)
))
expect(klass.login(login, password)).to be_truthy
adapter = double('adapter', dn: dn).as_null_object
allow_any_instance_of(described_class).
to receive(:adapter).and_return(adapter)
expect(described_class.login(login, password)).to be_truthy
end
it "is false if the user does not exist" do
# try only to fake the LDAP call
klass.any_instance.stub(adapter: double(:adapter,
bind_as: double(:ldap_user, dn: dn)
))
expect(klass.login(login, password)).to be_falsey
adapter = double('adapter', dn: dn).as_null_object
allow_any_instance_of(described_class).
to receive(:adapter).and_return(adapter)
expect(described_class.login(login, password)).to be_falsey
end
it "is false if authentication fails" do
user
expect(user).not_to be_nil
# try only to fake the LDAP call
klass.any_instance.stub(adapter: double(:adapter, bind_as: nil))
expect(klass.login(login, password)).to be_falsey
adapter = double('adapter', bind_as: nil).as_null_object
allow_any_instance_of(described_class).
to receive(:adapter).and_return(adapter)
expect(described_class.login(login, password)).to be_falsey
end
it "fails if ldap is disabled" do
Gitlab::LDAP::Config.stub(enabled?: false)
expect(klass.login(login, password)).to be_falsey
allow(Gitlab::LDAP::Config).to receive(:enabled?).and_return(false)
expect(described_class.login(login, password)).to be_falsey
end
it "fails if no login is supplied" do
expect(klass.login('', password)).to be_falsey
expect(described_class.login('', password)).to be_falsey
end
it "fails if no password is supplied" do
expect(klass.login(login, '')).to be_falsey
expect(described_class.login(login, '')).to be_falsey
end
end
end
\ No newline at end of file
end
......@@ -16,24 +16,24 @@ describe Gitlab::LDAP::User do
describe :changed? do
it "marks existing ldap user as changed" do
existing_user = create(:omniauth_user, extern_uid: 'my-uid', provider: 'ldapmain')
create(:omniauth_user, extern_uid: 'my-uid', provider: 'ldapmain')
expect(ldap_user.changed?).to be_truthy
end
it "marks existing non-ldap user if the email matches as changed" do
existing_user = create(:user, email: 'john@example.com')
create(:user, email: 'john@example.com')
expect(ldap_user.changed?).to be_truthy
end
it "dont marks existing ldap user as changed" do
existing_user = create(:omniauth_user, email: 'john@example.com', extern_uid: 'my-uid', provider: 'ldapmain')
create(:omniauth_user, email: 'john@example.com', extern_uid: 'my-uid', provider: 'ldapmain')
expect(ldap_user.changed?).to be_falsey
end
end
describe :find_or_create do
it "finds the user if already existing" do
existing_user = create(:omniauth_user, extern_uid: 'my-uid', provider: 'ldapmain')
create(:omniauth_user, extern_uid: 'my-uid', provider: 'ldapmain')
expect{ ldap_user.save }.to_not change{ User.count }
end
......@@ -52,11 +52,15 @@ describe Gitlab::LDAP::User do
end
end
describe 'blocking' do
def configure_block(value)
allow_any_instance_of(Gitlab::LDAP::Config).
to receive(:block_auto_created_users).and_return(value)
end
context 'signup' do
context 'dont block on create' do
before { Gitlab::LDAP::Config.any_instance.stub block_auto_created_users: false }
before { configure_block(false) }
it do
ldap_user.save
......@@ -66,7 +70,7 @@ describe Gitlab::LDAP::User do
end
context 'block on create' do
before { Gitlab::LDAP::Config.any_instance.stub block_auto_created_users: true }
before { configure_block(true) }
it do
ldap_user.save
......@@ -83,7 +87,7 @@ describe Gitlab::LDAP::User do
end
context 'dont block on create' do
before { Gitlab::LDAP::Config.any_instance.stub block_auto_created_users: false }
before { configure_block(false) }
it do
ldap_user.save
......@@ -93,7 +97,7 @@ describe Gitlab::LDAP::User do
end
context 'block on create' do
before { Gitlab::LDAP::Config.any_instance.stub block_auto_created_users: true }
before { configure_block(true) }
it do
ldap_user.save
......
......@@ -10,14 +10,14 @@ describe Gitlab::Upgrader do
describe 'latest_version?' do
it 'should be true if newest version' do
upgrader.stub(latest_version_raw: current_version)
allow(upgrader).to receive(:latest_version_raw).and_return(current_version)
expect(upgrader.latest_version?).to be_truthy
end
end
describe 'latest_version_raw' do
it 'should be latest version for GitLab 5' do
upgrader.stub(current_version_raw: "5.3.0")
allow(upgrader).to receive(:current_version_raw).and_return("5.3.0")
expect(upgrader.latest_version_raw).to eq("v5.4.2")
end
......
......@@ -77,13 +77,13 @@ eos
let(:other_issue) { create :issue, project: other_project }
it 'detects issues that this commit is marked as closing' do
commit.stub(safe_message: "Fixes ##{issue.iid}")
allow(commit).to receive(:safe_message).and_return("Fixes ##{issue.iid}")
expect(commit.closes_issues).to eq([issue])
end
it 'does not detect issues from other projects' do
ext_ref = "#{other_project.path_with_namespace}##{other_issue.iid}"
commit.stub(safe_message: "Fixes #{ext_ref}")
allow(commit).to receive(:safe_message).and_return("Fixes #{ext_ref}")
expect(commit.closes_issues).to be_empty
end
end
......@@ -93,7 +93,9 @@ eos
let(:author) { create(:user, email: commit.author_email) }
let(:backref_text) { "commit #{subject.id}" }
let(:set_mentionable_text) { ->(txt){ subject.stub(safe_message: txt) } }
let(:set_mentionable_text) do
->(txt) { allow(subject).to receive(:safe_message).and_return(txt) }
end
# Include the subject in the repository stub.
let(:extra_commits) { [subject] }
......
......@@ -11,7 +11,10 @@ describe Issue, "Issuable" do
end
describe "Validation" do
before { subject.stub(set_iid: false) }
before do
allow(subject).to receive(:set_iid).and_return(false)
end
it { is_expected.to validate_presence_of(:project) }
it { is_expected.to validate_presence_of(:iid) }
it { is_expected.to validate_presence_of(:author) }
......
......@@ -58,10 +58,10 @@ describe :forked_from_project do
end
def fork_project(from_project, user)
context = Projects::ForkService.new(from_project, user)
shell = double("gitlab_shell")
shell.stub(fork_repository: true)
context.stub(gitlab_shell: shell)
context.execute
end
shell = double('gitlab_shell', fork_repository: true)
service = Projects::ForkService.new(from_project, user)
allow(service).to receive(:gitlab_shell).and_return(shell)
service.execute
end
......@@ -24,8 +24,11 @@ describe GroupMember do
describe "#after_create" do
it "should send email to user" do
membership = build(:group_member)
membership.stub(notification_service: double('NotificationService').as_null_object)
allow(membership).to receive(:notification_service).
and_return(double('NotificationService').as_null_object)
expect(membership).to receive(:notification_service)
membership.save
end
end
......@@ -33,7 +36,8 @@ describe GroupMember do
describe "#after_update" do
before do
@group_member = create :group_member
@group_member.stub(notification_service: double('NotificationService').as_null_object)
allow(@group_member).to receive(:notification_service).
and_return(double('NotificationService').as_null_object)
end
it "should send email to user" do
......
......@@ -111,17 +111,18 @@ describe MergeRequest do
let(:commit2) { double('commit2', closes_issues: [issue1]) }