Sha256: 503835b7d4ca3c45bf7b0238fef955e8461cb8446293e955964007d522e42ea0

Contents?: true

Size: 677 Bytes

Versions: 3

Compression:

Stored size: 677 Bytes

Contents

module AddAllHelpersToView
  HELPER_PATH = OpenConferenceWare::Engine.root.join('app', 'helpers', 'open_conference_ware', '*.rb')
  def _all_helper_modules
    @@_all_helper_modules ||= [
      Dir.glob(HELPER_PATH).map {|f| "OpenConferenceWare::#{File.basename(f, '.rb').camelize}".constantize },
      OpenConferenceWare::Engine.routes.url_helpers
    ].flatten
  end

  def add_all_helpers_to(view)
    _all_helper_modules.each do |helper_module|
      view.extend(helper_module)
      self.class.send(:include, helper_module)
    end
  end
end

RSpec.configure do |c|
  c.include AddAllHelpersToView

  c.before :each, type: :view do
    add_all_helpers_to(view)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
open_conference_ware-1.0.0.pre4 spec/support/add_all_helpers_to_view.rb
open_conference_ware-1.0.0.pre3 spec/support/add_all_helpers_to_view.rb
open_conference_ware-1.0.0.pre2 spec/support/add_all_helpers_to_view.rb