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
path: root/spec
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-06-21 14:25:44 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2016-06-21 14:25:44 +0300
commit0468deafbd6fcf008eb672dd42b98390d95e8add (patch)
tree2d5e5340cc4d8c65bed826bc17c66ce898c733ef /spec
parent0d287b06a6fa7a373df03378f9f1a048e5890a4f (diff)
parentbfce7349ea7c2efcbeb3fb34a207aad65d3129e3 (diff)
Merge branch '18792-cache-participants-call' into 'master'
Cache Participable#participants in instance variable See merge request !4803
Diffstat (limited to 'spec')
-rw-r--r--spec/models/concerns/participable_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/models/concerns/participable_spec.rb b/spec/models/concerns/participable_spec.rb
index 7e4ea0f2d66..a9f4ef9ee5e 100644
--- a/spec/models/concerns/participable_spec.rb
+++ b/spec/models/concerns/participable_spec.rb
@@ -37,6 +37,16 @@ describe Participable, models: true do
expect(participants).to include(user3)
end
+ it 'caches the raw list of participants' do
+ instance = model.new
+ user1 = build(:user)
+
+ expect(instance).to receive(:raw_participants).once
+
+ instance.participants(user1)
+ instance.participants(user1)
+ end
+
it 'supports attributes returning another Participable' do
other_model = Class.new { include Participable }