Giter Site home page Giter Site logo

tracyloisel / instantspin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from skorfmann/instantspin

0.0 1.0 0.0 126 KB

Spin speeds up your Rails testing workflow by preloading your Rails environment.

Home Page: http://jstorimer.github.com/spin/

Ruby 100.00%

instantspin's Introduction

InstantSpin

Combined (spin) with (rails-dev-boost) for (nearly) instant test starts. Also added (growl) for notifications.

This setup works great for me with unit and functional tests (Test::Unit / MinitTest).

Compare the execution times of a simple functional test (rails 3.1 and ruby 1.9.3):

#Test Time:
1.270169 seconds

# Total execution time with instantspin
2.755599 seconds

# Total execution time with plain spin
14.565113 seconds

# Total execution time (ruby -Itest ...)
20.771 seconds

Installation

Rails

#Gemfile
group :development, :test do
  gem 'rails-dev-boost', :git => 'git://github.com/thedarkone/rails-dev-boost.git', :require => 'rails_development_boost'
end

group :development do
  gem "instantspin", :git => "git://github.com/skorfmann/instantspin.git"
end

Add config for rails-dev-boost but only if run via spin

#config/environments/test.rb
if $instantspin
  config.cache_classes = false
  config.soft_reload = true
else
  config.cache_classes = true
end

Ensure that ActiveRecord has an active connection

#test/test_helper.rb
ActiveRecord::Base.connection.reconnect!() if $instantspin

Done.

Usage

There are two components to Spin, a server and client. The server has to be running for anything interesting to happen. You can start the Spin server from your Rails.root with the following command:

bundle exec instantspin serve

As soon as the server is running it will be ready to accept from clients. You can use the following command to specify a file for the server to load:

bundle exec instantspin push test/unit/product_test.rb

Or push multiple files to be loaded at once:

bundle exec instantspin push test/unit/product_test.rb test/unit/shop_test.rb test/unit/cart_test.rb

If you experience issues with test_helper.rb not being available you may need to add your test directory to the load path using the -I option:

bundle exec instantspin serve -Itest

Send a SIGQUIT to spin serve (Ctrl+\) if you want to re-run the last files that were ran via spin push [files].

With Kicker

As mentioned, this tool works best with an autotest(ish) workflow. I haven't actually used with with autotest itself, but it works great with kicker. Here's the suggested workflow for a Rails app:

  1. Start up the spin server

    bundle exec instantspin serve
  2. Start up kicker using the custom binary option (and any other options you want)

    kicker -r rails -b 'spin push'
  3. Faster testing workflow!

Motivation

Easy solution for really fast test startup times!!!

Hacking

I take pull requests, and it's commit bit, and there are no tests.

Related Projects

If Spin isn't scratching your itch then one of these projects might:

instantspin's People

Contributors

bhb avatar bittersweet avatar bquorning avatar jstorimer avatar jtrim avatar maprihoda avatar skorfmann avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.