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
- Fork it ( https://github.com/ad2games/rspec-intercept/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request