RSpec on IRB
> (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”.
> 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
% irspec
> require 'rubygems' > require 'interactive_rspec' > irspec
gem 'interactive_rspec' % bundle
% rails c
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.
-
Fork, fix, then send me a pull request.
Copyright © 2011 Akira Matsuda. See MIT-LICENSE for further details.