Top "Stubbing" questions

Stubbing is modifying an instance method or property of an object at runtime to extend its functionality.

How to stub error raising using Rspec in Rails?

I'm new to Rails and Rspec and I'm using Rspec to test this controller method which includes exception handling: def …

ruby-on-rails ruby unit-testing rspec stubbing
Mockito: how to stub void methods to run some code when called

I want to stub a repository class to test another class (Holder class) that has a repository. The repository interface …

java unit-testing mockito void stubbing
How should I stub a method globally using RSpec?

I am working on a Rails application. I am trying to stub a method globally. What I am doing is …

ruby-on-rails ruby-on-rails-3 rspec mocking stubbing
Rspec 3.0 How to mock a method replacing the parameter but with no return value?

I've searched a lot and just cannot figure this out although it seems basic. Here's a way simplified example of …

ruby rspec mocking stubbing
Stubbing out functions or classes

Can you explain the concept stubbing out functions or classes taken from this article? class Loaf: pass This class doesn't …

python stub stubbing
RhinoMocks - Stub a Method That Returns a Parameter

I am using RhinoMocks, I need to stub a method, and always have it return the third parameter, regardless of …

unit-testing mocking rhino-mocks stubbing
Stubbing defaults in Mockito

How can I stub a method such that when given a value I'm not expecting, it returns a default value? …

java mockito stubbing
How to verify if a specific function is called

I'm trying my hand at writing TDD in Go. I am however stuck at the following. The test to write: …

go mocking stubbing
Should I stub the model in Factory girl or in the spec file while testing?

Almost every spec file I come accross I end up writing stuff like: before :each do @cimg = Factory.build :cimg_…

ruby-on-rails ruby unit-testing mocking stubbing
Rspec -- need to stub File.open that gets called in another file

In my test I'm initializing a new class called Package with some parameters. In the initialization of this class, I …

ruby testing rspec mocking stubbing