aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/pundit/pundit_view_policy.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/spec/support/pundit/pundit_view_policy.rb b/spec/support/pundit/pundit_view_policy.rb
index 91be0624c..b8434cac0 100644
--- a/spec/support/pundit/pundit_view_policy.rb
+++ b/spec/support/pundit/pundit_view_policy.rb
@@ -1,16 +1,16 @@
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(:pundit_user){ UserContext.new(current_user, referential: current_referential) }
- into.before do
- allow(view).to receive(:pundit_user) { pundit_user }
+ extend ActiveSupport::Concern
- allow(view).to receive(:policy) do |instance|
- ::Pundit.policy pundit_user, instance
+ included do
+ before do
+ controller.singleton_class.class_eval do
+ def policy(instance)
+ Class.new do
+ def method_missing(*args, &block); true; end
+ end.new
+ end
+ helper_method :policy
end
end
end