jasmine / jasmine-gem

Jasmine ruby gem
682 stars 274 forks source link

calling asset_path in .js.erb file does not include asset prefix #197

Closed jnimety closed 10 years ago

jnimety commented 10 years ago
$ rake jasmine:ci
Puma 2.8.1 starting...
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://0.0.0.0:41280
Waiting for jasmine server on 41280...
jasmine server started.

[7, 16] in RAILS_ROOT/app/assets/javascripts/_application.js.erb
    7:   showOn: 'both',
    8:   buttonImageOnly: true,
    9:   showButtonPanel: true,
   10:   changeMonth: true,
   11:   changeYear: true,
=> 12:   buttonImage: "<%= require 'byebug'; byebug; asset_path('calendar_date_select/calendar.gif') %>"
   13: };
   14:
   15: mediaplayer = control.namespace('control.mediaplayer');
   16: mediaplayer.load = (function mediaplayer($) {

(byebug) p asset_path('calendar_date_select/calendar.gif')
"/calendar_date_select/calendar.gif"
(byebug) p Rails.application.config.assets.prefix
"/force-dynamic-assets"
(byebug) p Rails.version
"4.0.3"
ragaskar commented 10 years ago

Hm, this is true, I think we don't copy in an asset prefix for the sprockets env we spin up. Would take a pull that fixes that (I think all you would need to do is pass Rails.application.assets, which is a configured env). That said, I think this is an edge that isn't going to be hit by too many of our users (more likely in css than js).

slackersoft commented 10 years ago

Looks like this was fixed with #216. Closing