Module: Jasmine

Defined in:
lib/jasmine-sprockets.rb,
lib/jasmine-sprockets/version.rb

Defined Under Namespace

Modules: Sprockets

Class Method Summary collapse

Class Method Details

.app(config) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/jasmine-sprockets.rb', line 9

def self.app(config)
  Rack::Builder.app {
    use Rack::Head

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

    map('/__JASMINE_ROOT__') { run Rack::JasmineFile.new(Jasmine::Core.path) }
    map(config.spec_path)    { run Rack::JasmineFile.new(config.spec_dir) }
    map(config.root_path)    { run Rack::JasmineFile.new(config.project_root) }

    map('/') do
      run Rack::Cascade.new([
        Rack::URLMap.new('/' => Rack::JasmineFile.new(config.src_dir)),
        Jasmine::RunAdapter.new(config)
      ])
    end
  }
end