Sha256: 345130e00c8b25312536fa2403ed8002176f16e7ff7245adf2f041aaccdd0e49

Contents?: true

Size: 988 Bytes

Versions: 3

Compression:

Stored size: 988 Bytes

Contents

module Konacha
  class Engine < Rails::Engine
    # Do not mess up the application's namespace.
    # http://api.rubyonrails.org/classes/Rails/Engine.html#label-Isolated+Engine
    isolate_namespace Konacha

    config.konacha = ActiveSupport::OrderedOptions.new

    def self.application(app)
      Rack::Builder.app do
        use Rack::ShowExceptions

        map app.config.assets.prefix do
          run app.assets
        end

        map "/" do
          run Engine
        end
      end
    end

    initializer "konacha.environment" do |app|
      unless app.config.assets.enabled
        raise RuntimeError, "konacha requires the asset pipeline to be enabled"
      end

      options = app.config.konacha

      options.spec_dir    ||= "spec/javascripts"
      options.port        ||= 3500
      options.application ||= self.class.application(app)
      options.driver      ||= :selenium

      app.config.assets.paths << app.root.join(options.spec_dir).to_s
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
konacha-1.5.1 lib/konacha/engine.rb
konacha-1.5.0 lib/konacha/engine.rb
konacha-1.4.2 lib/konacha/engine.rb