Sha256: d940a59015ba3dc0d32a0fa511b0f07c8dc8763138c6ef00ef5fbc145219cd65
Contents?: true
Size: 1.77 KB
Versions: 3
Compression:
Stored size: 1.77 KB
Contents
require 'jasmine-core' require 'lanes/command' module Lanes module API LanesDummyExt = Struct.new(:identifier, :root_path) class TestSpecs cattr_accessor :current attr_accessor :extension def initialize(ext) @extension = ext end def css_files urlpath Jasmine::Core.css_files end def js_files urlpath(Jasmine::Core.js_files) + urlpath(Jasmine::Core.boot_files) + urlpath(spec_files("helpers")) + urlpath(spec_files(extension.identifier)) end private def spec_files(path) dir = extension.root_path.join("spec") regex = /^#{dir}\// Dir.glob( dir.join(path,"**/*.{coffee,js}") ).map do |file| file.sub(regex,'').sub(/coffee$/,'js') end end def urlpath(files) files.map{ |file| "/spec/"+file } end end ext = Lanes::Command.load_current_extension || LanesDummyExt.new('lanes', Pathname.new(__FILE__).dirname.join("../../../")) TestSpecs.current = TestSpecs.new(ext) Root.sprockets.append_path(ext.root_path.join("spec")) Root.sprockets.append_path(Jasmine::Core.path) routes.draw do get '/spec' do content_type 'text/html' erb :specs, locals: { specs: TestSpecs.current } end get "/spec/*" do |path| env_sprockets = request.env.dup env_sprockets['PATH_INFO'] = path settings.sprockets.call env_sprockets end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lanes-0.1.2 | lib/lanes/api/test_specs.rb |
lanes-0.1.0 | lib/lanes/api/test_specs.rb |
lanes-0.0.8 | lib/lanes/api/test_specs.rb |