From 3aa5ff0d1f5e74b4c46c14e6240e7def82f0451d Mon Sep 17 00:00:00 2001 From: Zog Date: Mon, 18 Dec 2017 09:34:15 +0100 Subject: Refs #5291@0.1h; Fix rebase Fix integration_spec_helper after rebase --- spec/support/integration_spec_helper.rb | 37 ++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/spec/support/integration_spec_helper.rb b/spec/support/integration_spec_helper.rb index 5bcf0bd3a..78efb9027 100644 --- a/spec/support/integration_spec_helper.rb +++ b/spec/support/integration_spec_helper.rb @@ -1,26 +1,33 @@ module IntegrationSpecHelper - def with_permission permission, &block - context "with permission #{permission}" do - let(:permissions){ [permission] } - context('', &block) if block_given? - end - def paginate_collection klass, decorator, page=1 - ModelDecorator.decorate( klass.page(page), with: decorator ) - end + def paginate_collection klass, decorator, page=1 + ModelDecorator.decorate( klass.page(page), with: decorator ) + end - def build_paginated_collection factory, decorator, opts={} - count = opts.delete(:count) || 2 - page = opts.delete(:page) || 1 - klass = nil - count.times { klass ||= create(factory, opts).class } - paginate_collection klass, decorator, page + def build_paginated_collection factory, decorator, opts={} + count = opts.delete(:count) || 2 + page = opts.delete(:page) || 1 + klass = nil + count.times { klass ||= create(factory, opts).class } + paginate_collection klass, decorator, page + end + + module Methods + def with_permission permission, &block + context "with permission #{permission}" do + let(:permissions){ [permission] } + context('', &block) if block_given? + end end end + + def self.included into + into.extend Methods + end end RSpec.configure do |config| - config.extend IntegrationSpecHelper, type: :view + config.include IntegrationSpecHelper, type: :view end RSpec::Matchers.define :have_link_for_each_item do |collection, name, href| -- cgit v1.2.3