Sha256: 4c5965d95314e1c66a1b664bf7e4792af72895c08a620d8ac992503c41b39543

Contents?: true

Size: 1.31 KB

Versions: 9

Compression:

Stored size: 1.31 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.pathname = root
          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

9 entries across 9 versions & 1 rubygems

Version Path
refinerycms-testing-1.0.11 lib/refinerycms-testing.rb
refinerycms-testing-1.0.10 lib/refinerycms-testing.rb
refinerycms-testing-1.0.9 lib/refinerycms-testing.rb
refinerycms-testing-1.0.8 lib/refinerycms-testing.rb
refinerycms-testing-1.0.7 lib/refinerycms-testing.rb
refinerycms-testing-1.0.5 lib/refinerycms-testing.rb
refinerycms-testing-1.0.4 lib/refinerycms-testing.rb
refinerycms-testing-1.0.3 lib/refinerycms-testing.rb
refinerycms-testing-1.0.1 lib/refinerycms-testing.rb