Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #95 from Dishwasha/master
Browse files Browse the repository at this point in the history
asset_path helper in tests fail due to computed path being hardcoded
  • Loading branch information
searls committed Jan 6, 2014
2 parents 2895730 + 2016dd5 commit 67d4071
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/jasmine_rails/offline_asset_paths.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def compute_public_path_with_offline_asset(source, dir, options={})
source = source.to_s
return source if source.starts_with?('/')
content = Rails.application.assets[source].to_s
source_path = JasmineRails.tmp_dir.join('assets').join(source)
asset_prefix = Rails.configuration.assets.prefix.gsub(/\A\//,'')
source_path = JasmineRails.tmp_dir.join(asset_prefix).join(source)

FileUtils.mkdir_p File.dirname(source_path)
Rails.logger.debug "Compiling #{source} to #{source_path}"
Expand All @@ -32,7 +33,7 @@ def compute_public_path_with_offline_asset(source, dir, options={})
f << content
end
end
"/assets/#{source}"
"/#{asset_prefix}/#{source}"
end

end
Expand Down
3 changes: 2 additions & 1 deletion lib/jasmine_rails/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ def run(spec_filter = nil)
include_offline_asset_paths_helper
html = get_spec_runner(spec_filter)
runner_path = JasmineRails.tmp_dir.join('runner.html')
File.open(runner_path, 'w') {|f| f << html.gsub('/assets', './assets')}
asset_prefix = Rails.configuration.assets.prefix.gsub(/\A\//,'')
File.open(runner_path, 'w') {|f| f << html.gsub("/#{asset_prefix}", "./#{asset_prefix}")}

phantomjs_runner_path = File.join(File.dirname(__FILE__), '..', 'assets', 'javascripts', 'jasmine-runner.js')
run_cmd %{phantomjs "#{phantomjs_runner_path}" "#{runner_path.to_s}?spec=#{spec_filter}"}
Expand Down

0 comments on commit 67d4071

Please sign in to comment.