diff options
| author | Zog | 2017-12-18 09:25:10 +0100 |
|---|---|---|
| committer | Zog | 2017-12-19 14:40:38 +0100 |
| commit | 548fe7f13d698fe9a6620ef60fc239f28347af79 (patch) | |
| tree | 4ce7ceef8012ddee92cae6f9fb87f634ca0cf0d0 | |
| parent | 2091a1ababa68810f42257fb392692f80b3bd78f (diff) | |
| download | chouette-core-548fe7f13d698fe9a6620ef60fc239f28347af79.tar.bz2 | |
Refs #5287; CR 1
- Get rid of ActiveSupport::Concern in the spec helpers
- Rename misnamed spec files
| -rw-r--r-- | spec/support/integration_spec_helper.rb | 15 | ||||
| -rw-r--r-- | spec/support/pundit/pundit_view_policy.rb | 17 | ||||
| -rw-r--r-- | spec/views/connection_links/show.html.slim_spec.rb (renamed from spec/views/connection_links/show.html.erb_spec.rb) | 0 | ||||
| -rw-r--r-- | spec/views/stop_areas/index.html.slim_spec.rb (renamed from spec/views/stop_areas/index.html.erb_spec.rb) | 0 |
4 files changed, 12 insertions, 20 deletions
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| diff --git a/spec/views/connection_links/show.html.erb_spec.rb b/spec/views/connection_links/show.html.slim_spec.rb index afe94fc6c..afe94fc6c 100644 --- a/spec/views/connection_links/show.html.erb_spec.rb +++ b/spec/views/connection_links/show.html.slim_spec.rb diff --git a/spec/views/stop_areas/index.html.erb_spec.rb b/spec/views/stop_areas/index.html.slim_spec.rb index e0c50685c..e0c50685c 100644 --- a/spec/views/stop_areas/index.html.erb_spec.rb +++ b/spec/views/stop_areas/index.html.slim_spec.rb |
