Skip to content

elamaranae/fsr

Repository files navigation

fsr - fast spec runner

fsr listens for file change events and runs RSpecs automatically in rails console avoiding the rails boot process and provides instant feedback which is crucial for Test Driven Development (TDD).

Installation

  1. Add fsr to your app’s Gemfile in test:

    group :test do
      gem 'fsr'
    end
  2. Then, in your project directory:

    $ bundle install

Usage

Open rails console in test environment.

 RAILS_ENV=test bundle exec rails c

All following examples should be run in this console.

listener = Fsr.listen(['spec/models/user_spec.rb'])
listener.start

This will listen to any file change events, automatically load the changed file and run the given spec.

To stop the listener,

listener.stop

By default, it listens for file change events on app/, lib/, spec/ directories. This can be overriden with listen option.

Fsr.listen(['spec/models/user_spec.rb'], listen: ['dir/'])

You can pass any RSpec command line arguments. For example, to run based on line number.

Fsr.listen(['spec/models/user_spec.rb:12'])

To run based on line number.

Fsr.listen(['spec/models/user_spec.rb', 'spec/models/admin_spec.rb'])

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/elamaranae/fsr. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Fsr project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

Run RSpec fast avoiding full app boot

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published