Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5848843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:54:59+00:00 2026-05-22T12:54:59+00:00

I have a rails app that is combining javascript assets using Jammit , and

  • 0

I have a rails app that is combining javascript assets using Jammit, and I’d like to use Jasmine for BDD-style testing of my javascript. I’m wondering if anyone has any advice on accessing the Jammit-generated ‘pacakges’ from within Jasmine?

The issue is that Jasmine is configured by defining a list of JS files on disk to test, and it then includes those files within its own test runner page which is loaded and run in a browser.

I could reference each of the individual JS files inside of the jasmine.yml config file before they’re packaged with Jammit… however, Jammit is already dealing with dependencies between files for me, and, more importantly, I also need access to the compiled javascript templates that Jammit produces.

I could also manually run Jammit to generate the compiled assets first and then run Jasmine, but I’d wind up having to re-generate the assets by hand before each test run in order to test changes, which would seriously cramp a fast test-driven type workflow.

I’m wondering if I could somehow:

  • Mount the Jammit controller from within Jasmine’s rack server so it could serve out the packages from Jasmine? This would basically work the same way as Jammit already does from within Rails’ development env.
  • Hook into Jasmine somehow to package the assets on every page load before the tests are executed? This would be slower, but would save me a step and ensure things were up to date.

Any suggestions? I’m just getting started with this, so I could be going about it all wrong. Any advice would be greatly appreciated. 🙂

Thanks!
-John

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:54:59+00:00Added an answer on May 22, 2026 at 12:54 pm

    Here’s the magic combo you’re looking for:

    1. Use the guard gem along with the guard-jammit gem to watch for changes to your project’s assets
    2. Install the LiveReload plugin in the browser of your choice and install the guard-livereload gem so you can have your browser auto reload whenever your specs or assets change.
    3. Fire up guard, then rake jasmine, then load your jasmine specs in your browser, then press the live-reload button to connect to the live-reload server that guard started
    4. Change your files. Watch the magic happen as guard runs jammit and instructs your browser to refresh the jasmine specs.

    Here’s an example Guardfile to get you started:

    guard 'jammit' do
      watch(%r{public/javascripts/(.*)\.js})
      watch(%r{app/views/jst/(.*)\.jst})
      watch(%r{public/stylesheets/(.*)\.css})
    end
    
    guard 'livereload', :apply_js_live => false do
      watch(%r{app/.+\.(erb|haml)})
      watch(%r{app/helpers/.+\.rb})
      watch(%r{public/.+\.(css|js|html)})
      watch(%r{config/locales/.+\.yml})
      watch(%r{spec/javascripts/.+\.js})
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rails app that uses heavily js (over 1MB total). I'd like
I have a Ruby script in my Rails app that I use to load
I have a Rails app with an API endpoint that I'd like to authenticate
I have a Rails app that uses activescaffold and I would like to hide
I have a rails app that I have serving up XML on an infrequent
I have a Rails app that I have successfully tested with Mongrel and Webkit.
I have a Rails app that I need to deploy. Here are the facts:
I have a rails app that has picked up a bit of traction, but
I have a Rails app that sets a cookie and does a redirect to
I have a Rails app that will post some data to another Rails app.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.