Giter Site home page Giter Site logo

interactive_rspec's Introduction

Interactive RSpec

RSpec on IRB

Features

Execute RSpec matchers in the console

> (1+1).should == 3
F

Failures:

  1)
     Failure/Error: Unable to find matching line from backtrace
       expected: 3
            got: 2 (using ==)
     # (irb):2

Finished in 18.53 seconds
1 example, 1 failure

Failed examples:

rspec ./.rvm/gems/ruby-1.8.7-p334/gems/interactive_rspec-0.0.1/lib/interactive_rspec.rb:44 #
=> false

Let’s call this the “interactive RSpec”.

Execute spec file(s) via running IRB session

> irspec 'path/to/spec_file_spec.rb'

The filename parameter matches to various shortcuts such as:

'spec/foo'    => spec/foo_spec.rb
'models/user' => spec/models/user_spec.rb
'controllers' => spec/controllers/**/*_spec.rb
:all          => **/*_spec.rb

How to start

Launch an interactive RSpec console via CLI

% irspec

Launch an interactive RSpec console via running IRB session

> require 'rubygems'
> require 'interactive_rspec'
> irspec

With Rails

Bundle interactive_rspec gem

gem 'interactive_rspec'

% bundle

Start up your Rails console

% rails c

Then it’s done!

You can check how the matchers work:

> irspec
> User.new(:name => 'matz').should_not be_valid

You can run any of the existing spec files:

> irspec 'spec/requests/users_spec.rb'

You might notice that it runs suuuuper fast since irspec uses already loaded Rails process.

Contributing to Interactive RSpec

  • Fork, fix, then send me a pull request.

Copyright © 2011 Akira Matsuda. See MIT-LICENSE for further details.

interactive_rspec's People

Contributors

amatsuda avatar kakutani avatar takkanm 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.