Sha256: 45d27756d7938dc4ef7bf61ecde25d673921417abdea58db27270badb22d9386

Contents?: true

Size: 1.34 KB

Versions: 10

Compression:

Stored size: 1.34 KB

Contents

require 'rack'
require 'rack/utils'
require 'jasmine-core'
require 'rack/jasmine/runner'
require 'rack/jasmine/focused_suite'
require 'rack/jasmine/redirect'
require 'rack/jasmine/cache_control'
require 'ostruct'

module Jasmine
  class Application
    def self.app(config = Jasmine::RunnerConfig.new)
      page = Jasmine::Page.new(config)
      if Jasmine::Dependencies.rails_3_asset_pipeline?
        config.src_mapper = Jasmine::AssetPipelineMapper.new
      end
      Rack::Builder.app do
        use Rack::Head
        use Rack::Jasmine::CacheControl
        if Jasmine::Dependencies.rails_3_asset_pipeline?
          map('/assets') do
            run Rails.application.assets
          end
        end

        map('/run.html')         { run Rack::Jasmine::Redirect.new('/') }
        map('/__suite__')        { run Rack::Jasmine::FocusedSuite.new(config) }

        #TODO: These path mappings should come from the config.
        map('/__JASMINE_ROOT__') { run Rack::File.new(Jasmine::Core.path) }
        map(config.spec_path)    { run Rack::File.new(config.spec_dir) }
        map(config.root_path)    { run Rack::File.new(config.project_root) }

        map('/') do
          run Rack::Cascade.new([
            Rack::URLMap.new('/' => Rack::File.new(config.src_dir)),
            Rack::Jasmine::Runner.new(page)
          ])
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rally-jasmine-1.2.0.10 lib/jasmine/application.rb
rally-jasmine-1.2.0.8 lib/jasmine/application.rb
rally-jasmine-1.2.0.7 lib/jasmine/application.rb
rally-jasmine-1.2.0.6 lib/jasmine/application.rb
rally-jasmine-1.2.0.5 lib/jasmine/application.rb
rally-jasmine-1.2.0.4 lib/jasmine/application.rb
rally-jasmine-1.2.0.3 lib/jasmine/application.rb
rally-jasmine-1.2.0.2 lib/jasmine/application.rb
rally-jasmine-1.2.0.1 lib/jasmine/application.rb
rally-jasmine-1.2.0 lib/jasmine/application.rb