Sha256: 42237abf318af4fa570253d094e45c54a08505010c1e85cae4636a30b2347b22

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

require 'refinerycms-core'
require 'rspec-rails'

module Refinery
  module Testing

    class << self
      attr_accessor :root
      def root
        @root ||= Pathname.new(File.expand_path('../../', __FILE__))
      end
    end

    class Engine < ::Rails::Engine

      initializer 'serve static assets' do |app|
        app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
      end

      config.before_configuration do
        ::Refinery::Application.module_eval do
          def load_tasks
            super

            # To get specs from all Refinery engines, not just those in Rails.root/spec/
            ::RSpec::Core::RakeTask.module_eval do
              def pattern
                [@pattern] | ::Refinery::Plugins.registered.pathnames.map{|p|
                               p.join('spec', '**', '*_spec.rb').to_s
                             }
              end
            end if defined?(::RSpec::Core::RakeTask)
          end
        end
      end

      config.after_initialize do
        ::Refinery::Plugin.register do |plugin|
          plugin.name = 'refinerycms_testing_plugin'
          plugin.version = ::Refinery.version
          plugin.hide_from_menu = true
        end
      end
    end

  end
end

::Refinery.engines << 'testing'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
refinerycms-testing-1.0.0 lib/refinerycms-testing.rb
refinerycms-testing-0.9.9.22 lib/refinerycms-testing.rb
refinerycms-testing-0.9.9.21 lib/refinerycms-testing.rb