rspec-mocks icon indicating copy to clipboard operation
rspec-mocks copied to clipboard

RSpec's 'test double' framework, with support for stubbing and mocking

Results 71 rspec-mocks issues
Sort by recently updated
recently updated
newest added

### Subject of the issue When mocking a method in an outer and inner scope using combinations of `expect` and `allow`, the mocks leak out of the inner scope. I...

When you call keyword argument methods with hashes (e.g. if a `method_missing` doesn't have a proper `ruby2_keywords` call or a keyword splat) then the diff is confusing because it looks...

### Subject of the issue The `method` variable that's provided to the block in `and_wrap_original` is bound to the mocked class but should instead be bound to `self`, which won't...

### Subject of the issue When you have a class implementing method via `method_missing` and the name is same as private method in parent class, `expect(xx)` does not work. ###...

### Subject of the issue When using Forwardable delegators, if the destination object is a spy, a kernel warning will be emitted of the form: > `warning: [Class]#[method name] at...

## What Ruby, Rails and RSpec versions are you using? Ruby version: ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-darwin17] Rails version: Rails 5.2.1 Rspec version: RSpec 3.8 ## Observed behaviour I...

### deprecate any_instance_of family of methods [rubocop-rspec already discourages the use of allow/expect_any_instance_of](https://www.rubydoc.info/gems/rubocop-rspec/1.6.0/RuboCop/Cop/RSpec/AnyInstance), and a workaround is provided. Also, from the [rspec documentation around these methods](https://relishapp.com/rspec/rspec-mocks/docs/working-with-legacy-code/any-instance), it's argued that using...

### Your environment * Ruby version: 2.5.x * rspec-mocks version: 3.10 ### Steps to reproduce In a before block I have: ``` before(:each) do allow_any_instance_of(MyClass).to receive(:my_method) { |instance, arg1, arg2|...

It may not be guaranteed in future versions.

### Subject of the issue This https://github.com/drapergem/draper/blob/master/lib/draper/helper_proxy.rb ```ruby require "bundler/inline" gemfile(true) do source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } gem "rspec", github: "rspec/rspec" gem "rspec-core", github: "rspec/rspec-core" gem "rspec-expectations", github:...