Commit 23193ed0 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'leaky-constant-fix-17' into 'master'

Fix leaky constant in mentionable spec

See merge request gitlab-org/gitlab!32049
parents c20e990d 48dbac23
...@@ -383,8 +383,6 @@ RSpec/LeakyConstantDeclaration: ...@@ -383,8 +383,6 @@ RSpec/LeakyConstantDeclaration:
- 'spec/models/concerns/blocks_json_serialization_spec.rb' - 'spec/models/concerns/blocks_json_serialization_spec.rb'
- 'spec/models/concerns/bulk_insert_safe_spec.rb' - 'spec/models/concerns/bulk_insert_safe_spec.rb'
- 'spec/models/concerns/bulk_insertable_associations_spec.rb' - 'spec/models/concerns/bulk_insertable_associations_spec.rb'
- 'spec/models/concerns/mentionable_spec.rb'
- 'spec/models/concerns/reactive_caching_spec.rb'
- 'spec/models/concerns/triggerable_hooks_spec.rb' - 'spec/models/concerns/triggerable_hooks_spec.rb'
- 'spec/models/repository_spec.rb' - 'spec/models/repository_spec.rb'
- 'spec/policies/merge_request_policy_spec.rb' - 'spec/policies/merge_request_policy_spec.rb'
......
---
title: Fix leaky constant issue in mentionable spec
merge_request: 32049
author: Rajendra Kadam
type: fixed
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
require 'spec_helper' require 'spec_helper'
describe Mentionable do describe Mentionable do
class Example before do
stub_const('Example', Class.new)
Example.class_eval do
include Mentionable include Mentionable
attr_accessor :project, :message attr_accessor :project, :message
...@@ -13,6 +15,7 @@ describe Mentionable do ...@@ -13,6 +15,7 @@ describe Mentionable do
nil nil
end end
end end
end
describe 'references' do describe 'references' do
let(:project) { create(:project) } let(:project) { create(:project) }
...@@ -28,11 +31,11 @@ describe Mentionable do ...@@ -28,11 +31,11 @@ describe Mentionable do
end end
describe '#any_mentionable_attributes_changed?' do describe '#any_mentionable_attributes_changed?' do
Message = Struct.new(:text) message = Struct.new(:text)
let(:mentionable) { Example.new } let(:mentionable) { Example.new }
let(:changes) do let(:changes) do
msg = Message.new('test') msg = message.new('test')
changes = {} changes = {}
changes[msg] = ['', 'some message'] changes[msg] = ['', 'some message']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment