pivotal/jasmine-gem — pull request #99 by pivotal-commander (2012-08-24 20:11:54+00:00)
Title: Refactored AssetPipelineMapper

... for jasmine to run with sprockets without the Rails Asset Pipeline

We are testing our JS app without Rails, but with sprockets. We have a need for the tests to split out the bundled application.js into its component js files. We did this by refactoring the AssetPipelineMapper into a plugin, #src_mapper, (of sorts) that is a property of Jasmine::Config.

We modified Jasmine::Application to create the asset pipeline mapper (instead of in Jasmine::Config). Interestingly, it simplifies Config and consolidates the Asset Pipeline responsibility into the Application class.

If you want to use your own src mapper, write your own Application class, as we did in commander and assign config.src_mapper. The source mapper class is required to implement only 1 method, #files(src_files), that does the right thing.

We rewrote the AssetPipelineMapper class slightly to conform to the new interface.

It seems that you could write a FileSystemMapper class to do the right thing as well, so the refactor "feels" right.

Stop by the GP Commander desks for a demo.

Ken Mayer & Vinson Chuong