Class: Jasmine::RunAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/jax/monkeypatch/jasmine/server.rb

Instance Method Summary collapse

Instance Method Details

#_runObject



3
# File 'lib/jax/monkeypatch/jasmine/server.rb', line 3

alias _run run

#run(focused_suite = nil) ⇒ Object

overridden method so that we can use a custom html file noinspection RubyUnusedLocalVariable



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/jax/monkeypatch/jasmine/server.rb', line 6

def run(focused_suite = nil)
  # regenerate volatile files
  Rake::Task['compile'].execute if $JAX_DEVELOPMENT             # rebuild jax itself if we're in gem development
  Rake::Task['jax:generate_files'].execute if !$JAX_RAKE        # rebuild the project resources, routes, etc
  
  custom_file = Jax.root && Jax.root.join("spec/javascripts/support/spec_layout.html.erb")
  return _run(focused_suite) if !custom_file || !File.file?(custom_file)
  
  jasmine_files = @jasmine_files
  css_files = @jasmine_stylesheets + (@config.css_files || [])
  js_files = @config.js_files(focused_suite)
  body = ERB.new(File.read(custom_file)).result(binding)
  [
    200,
    { 'Content-Type' => 'text/html' },
    [body]
  ]
end