RSpec::Intercept

Lets you intercept method calls in RSpec tests and tinker with the arguments for or the return value of the original method.

Installation

Add this line to your application's Gemfile:

gem 'rspec-intercept'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rspec-intercept

Usage

intercept(Foo, :bar) do |method, *args, &block|
  method.call(*args, &block)
end

intercept_any_instance_of(Foo, :bar) do |method, *args, &block|
  method.call(*args, &block)
end

Contributing

  1. Fork it ( https://github.com/ad2games/rspec-intercept/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request