aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support
diff options
context:
space:
mode:
authorLuc Donnet2018-02-08 17:46:49 +0100
committerGitHub2018-02-08 17:46:49 +0100
commitd0f6b92c7cbf48fad205bb96b85d8305f80d13dc (patch)
treecde6a6b74efee2f9f66edf920930cba259687dc7 /spec/support
parente07ef0eb9dac728ee5033b42c318692e2368b897 (diff)
parent6e902fd70fdd21e0ee31fa5f2ee764357b0ea477 (diff)
downloadchouette-core-d0f6b92c7cbf48fad205bb96b85d8305f80d13dc.tar.bz2
Merge pull request #253 from af83/5683-add_workgroup_id_to_calendars
First draft for including calendars into workgroup
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/pundit/pundit_view_policy.rb5
-rw-r--r--spec/support/referential.rb4
2 files changed, 4 insertions, 5 deletions
diff --git a/spec/support/pundit/pundit_view_policy.rb b/spec/support/pundit/pundit_view_policy.rb
index 91be0624c..330209049 100644
--- a/spec/support/pundit/pundit_view_policy.rb
+++ b/spec/support/pundit/pundit_view_policy.rb
@@ -2,9 +2,8 @@ module Pundit
module PunditViewPolicy
def self.included into
into.let(:permissions){ nil }
- into.let(:organisation){ referential.try(:organisation) }
- into.let(:current_referential){ referential || build_stubbed(:referential) }
- into.let(:current_user){ build_stubbed :user, permissions: permissions, organisation: organisation }
+ into.let(:current_referential){ referential || build_stubbed(:referential, organisation: organisation) }
+ into.let(:current_user){ create :user, permissions: permissions, organisation: organisation }
into.let(:pundit_user){ UserContext.new(current_user, referential: current_referential) }
into.before do
allow(view).to receive(:pundit_user) { pundit_user }
diff --git a/spec/support/referential.rb b/spec/support/referential.rb
index 497ff47a8..9acdce73a 100644
--- a/spec/support/referential.rb
+++ b/spec/support/referential.rb
@@ -11,8 +11,8 @@ module ReferentialHelper
def self.included(base)
base.class_eval do
extend ClassMethods
- alias_method :referential, :first_referential
- alias_method :organisation, :first_organisation
+ base.let(:referential){ first_referential }
+ base.let(:organisation){ first_organisation }
end
end