Class: Jasmine::RunAdapter
- Inherits:
-
Object
- Object
- Jasmine::RunAdapter
- Defined in:
- lib/jasmine-ruby/jasmine_runner.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(spec_files_or_proc, options = {}) ⇒ RunAdapter
constructor
A new instance of RunAdapter.
- #run ⇒ Object
Constructor Details
#initialize(spec_files_or_proc, options = {}) ⇒ RunAdapter
Returns a new instance of RunAdapter.
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/jasmine-ruby/jasmine_runner.rb', line 65 def initialize(spec_files_or_proc, = {}) @spec_files_or_proc = Jasmine.files(spec_files_or_proc) || [] @jasmine_files = Jasmine.files([:jasmine_files]) || [ "/__JASMINE_ROOT__/lib/" + File.basename(Dir.glob("#{Jasmine.root}/lib/jasmine*.js").first), "/__JASMINE_ROOT__/lib/TrivialReporter.js", "/__JASMINE_ROOT__/lib/json2.js", "/__JASMINE_ROOT__/lib/consolex.js", ] @stylesheets = ["/__JASMINE_ROOT__/lib/jasmine.css"] + (Jasmine.files([:stylesheets]) || []) @spec_helpers = Jasmine.files([:spec_helpers]) || [] end |
Instance Method Details
#call(env) ⇒ Object
77 78 79 |
# File 'lib/jasmine-ruby/jasmine_runner.rb', line 77 def call(env) run end |
#run ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/jasmine-ruby/jasmine_runner.rb', line 81 def run stylesheets = @stylesheets spec_helpers = @spec_helpers spec_files = @spec_files_or_proc jasmine_files = @jasmine_files jasmine_files = jasmine_files.call if jasmine_files.respond_to?(:call) css_files = @stylesheets body = ERB.new(File.read(File.join(File.dirname(__FILE__), "run.html"))).result(binding) [ 200, { 'Content-Type' => 'text/html' }, body ] end |