Fix js paths when served from somewhere other than /.
This commit is contained in:
parent
5821de0801
commit
c8b38ea47a
9
Rakefile
9
Rakefile
|
@ -47,13 +47,12 @@ namespace :jeweler do
|
|||
|
||||
Jeweler::Tasks.new do |gemspec|
|
||||
gemspec.name = "xian-test-jasmine"
|
||||
gemspec.summary = "Jasmine Ruby"
|
||||
gemspec.description = "Javascript BDD testings"
|
||||
gemspec.summary = "Jasmine for Ruby"
|
||||
gemspec.description = "Javascript BDD test framework"
|
||||
gemspec.email = "ragaskar@gmail.com"
|
||||
gemspec.homepage = "http://github.com/ragaskar/jasmine-ruby"
|
||||
gemspec.description = "Jasmine Ruby"
|
||||
gemspec.authors = ["Rajan Agaskar"]
|
||||
gemspec.files = FileList.new('bin/*', 'lib/**/**', 'jasmine/lib/**', 'jasmine/contrib/ruby/**', 'tasks/**', 'templates/**')
|
||||
gemspec.authors = ["Rajan Agaskar", "Christian Williams"]
|
||||
gemspec.files = FileList.new('bin/jasmine', 'lib/**/**', 'jasmine/lib/**', 'jasmine/contrib/ruby/**', 'tasks/**', 'templates/**')
|
||||
|
||||
gemspec.add_dependency('rspec', '>= 1.1.5')
|
||||
gemspec.add_dependency('rack', '>= 1.0.0')
|
||||
|
|
|
@ -69,10 +69,6 @@ module Jasmine
|
|||
@client.eval_js(script)
|
||||
end
|
||||
|
||||
def mappings
|
||||
raise "You need to declare a mappings method in #{self.class}!"
|
||||
end
|
||||
|
||||
def stylesheets
|
||||
[]
|
||||
end
|
||||
|
@ -114,7 +110,7 @@ module Jasmine
|
|||
end
|
||||
|
||||
def js_files
|
||||
src_files.collect {|f| File.join(src_path, f) } + spec_files.collect {|f| File.join(spec_path, f) }
|
||||
src_files.collect {|f| "/" + File.join(src_path, f) } + spec_files.collect {|f| "/" + File.join(spec_path, f) }
|
||||
end
|
||||
|
||||
def spec_files_full_paths
|
||||
|
|
|
@ -18,8 +18,8 @@ module Jasmine
|
|||
#noinspection RubyUnusedLocalVariable
|
||||
def run
|
||||
jasmine_files = @jasmine_files
|
||||
css_files = @jasmine_stylesheets + (Jasmine.files(@config.stylesheets) || [])
|
||||
js_files = Jasmine.files(@config.js_files)
|
||||
css_files = @jasmine_stylesheets + (@config.stylesheets || [])
|
||||
js_files = @config.js_files
|
||||
|
||||
body = ERB.new(File.read(File.join(File.dirname(__FILE__), "run.html.erb"))).result(binding)
|
||||
[
|
||||
|
@ -59,12 +59,12 @@ module Jasmine
|
|||
class FocusedSuite
|
||||
def initialize(config)
|
||||
@config = config
|
||||
# @spec_files_or_proc = Jasmine.files(spec_files_or_proc) || []
|
||||
# @spec_files_or_proc = spec_files_or_proc || []
|
||||
# @options = options
|
||||
end
|
||||
|
||||
def call(env)
|
||||
spec_files = Jasmine.files(@config.spec_files_or_proc)
|
||||
spec_files = @config.spec_files_or_proc
|
||||
matching_specs = spec_files.select {|spec_file| spec_file =~ /#{Regexp.escape(env["PATH_INFO"])}/ }.compact
|
||||
if !matching_specs.empty?
|
||||
run_adapter = Jasmine::RunAdapter.new(matching_specs, @options)
|
||||
|
@ -80,12 +80,6 @@ module Jasmine
|
|||
|
||||
end
|
||||
|
||||
def self.files(f)
|
||||
result = f
|
||||
result = result.call if result.respond_to?(:call)
|
||||
result
|
||||
end
|
||||
|
||||
class Server
|
||||
attr_reader :thin
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ describe Jasmine::Config do
|
|||
|
||||
it "should provide a list of all js files" do
|
||||
@config.js_files.should == [
|
||||
'src/javascripts/Example.js',
|
||||
'spec/javascript/ExampleSpec.js',
|
||||
'spec/javascript/SpecHelper.js',
|
||||
'/src/javascripts/Example.js',
|
||||
'/spec/javascript/ExampleSpec.js',
|
||||
'/spec/javascript/SpecHelper.js',
|
||||
]
|
||||
end
|
||||
|
||||
|
@ -40,9 +40,9 @@ describe Jasmine::Config do
|
|||
@config.stub!(:spec_path).and_return("spekz")
|
||||
|
||||
@config.js_files.should == [
|
||||
'public/javascripts/Example.js',
|
||||
'spekz/javascript/ExampleSpec.js',
|
||||
'spekz/javascript/SpecHelper.js',
|
||||
'/public/javascripts/Example.js',
|
||||
'/spekz/javascript/ExampleSpec.js',
|
||||
'/spekz/javascript/SpecHelper.js',
|
||||
]
|
||||
|
||||
@config.mappings.should == {
|
||||
|
|
Loading…
Reference in New Issue