Permalink
Browse files

Fix js paths when served from somewhere other than /.

  • Loading branch information...
1 parent 5821de0 commit c8b38ea47a5a3bfa23fd8b87f53a58a1bb000b7f @xian xian committed Dec 29, 2009
Showing with 15 additions and 26 deletions.
  1. +4 −5 Rakefile
  2. +1 −5 lib/jasmine/config.rb
  3. +4 −10 lib/jasmine/server.rb
  4. +6 −6 spec/config_spec.rb
View
@@ -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')
View
@@ -69,10 +69,6 @@ def eval_js(script)
@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 @@ def mappings
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
View
@@ -18,8 +18,8 @@ def call(env)
#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 @@ def call(env)
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 @@ def call(env)
end
- def self.files(f)
- result = f
- result = result.call if result.respond_to?(:call)
- result
- end
-
class Server
attr_reader :thin
View
@@ -22,9 +22,9 @@
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 @@
@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 == {

0 comments on commit c8b38ea

Please sign in to comment.