testdouble / jasmine-rails

A Jasmine runner for rails projects that's got you covered in both the terminal and the browser
http://rubygems.org/gems/jasmine-rails
MIT License
378 stars 154 forks source link

Out of date monkey patch on `compute_asset_path` breaks minitest on Rails 5.0.1+ #213

Closed fofr closed 6 years ago

fofr commented 6 years ago

The JasmineRails::OfflineAssetPaths monkey patch of compute_asset_path has a Rails 3 signature: https://github.com/searls/jasmine-rails/blob/master/lib/jasmine_rails/offline_asset_paths.rb#L9

This was updated from 3 arguments to 2 in Rails 4: https://apidock.com/rails/ActionView/AssetPaths/compute_public_path vs https://apidock.com/rails/ActionView/Helpers/AssetUrlHelper/compute_asset_path

If JasmineRails::OfflineAssetPaths.disabled is true, then the method is meant to shortcut and run the original super method. This gives an error like:

ActionView::Template::Error: wrong number of arguments (given 3, expected 1..2)

We found this issue after updating Rails from 5.0.0.1 to 5.0.1 (see https://github.com/alphagov/government-frontend/pull/439). Before this update the Minitests rake task ran before the spec:javascript one. As of 5.0.1 Minitest runs on the at_exit hook, meaning it always runs after Jasmine does.

Identified mostly by @h-lame