From 548fe7f13d698fe9a6620ef60fc239f28347af79 Mon Sep 17 00:00:00 2001 From: Zog Date: Mon, 18 Dec 2017 09:25:10 +0100 Subject: Refs #5287; CR 1 - Get rid of ActiveSupport::Concern in the spec helpers - Rename misnamed spec files --- spec/support/integration_spec_helper.rb | 15 +++++---------- spec/support/pundit/pundit_view_policy.rb | 17 +++++++---------- 2 files changed, 12 insertions(+), 20 deletions(-) (limited to 'spec/support') diff --git a/spec/support/integration_spec_helper.rb b/spec/support/integration_spec_helper.rb index 958aab9d5..182cadf24 100644 --- a/spec/support/integration_spec_helper.rb +++ b/spec/support/integration_spec_helper.rb @@ -1,17 +1,12 @@ module IntegrationSpecHelper - extend ActiveSupport::Concern - - included do - def self.with_permission permission, &block - context "with permission #{permission}" do - let(:permissions){ [permission] } - context('', &block) if block_given? - end + def with_permission permission, &block + context "with permission #{permission}" do + let(:permissions){ [permission] } + context('', &block) if block_given? end end end - RSpec.configure do |config| - config.include IntegrationSpecHelper, type: :view + config.extend IntegrationSpecHelper, type: :view end diff --git a/spec/support/pundit/pundit_view_policy.rb b/spec/support/pundit/pundit_view_policy.rb index 6a663a471..91be0624c 100644 --- a/spec/support/pundit/pundit_view_policy.rb +++ b/spec/support/pundit/pundit_view_policy.rb @@ -1,15 +1,12 @@ module Pundit module PunditViewPolicy - extend ActiveSupport::Concern - - included do - - let(:permissions){ nil } - let(:organisation){ referential.try(:organisation) } - let(:current_referential){ referential || build_stubbed(:referential) } - let(:current_user){ build_stubbed :user, permissions: permissions, organisation: organisation } - let(:pundit_user){ UserContext.new(current_user, referential: current_referential) } - before do + 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 } allow(view).to receive(:policy) do |instance| -- cgit v1.2.3