[rspec-users] Stubbing return arguments

rhydiant rhydiant at googlemail.com
Sat May 15 03:56:31 EDT 2010

I'm writting a code example for the following method:

    def upload(email_address, product_data)
      errors = []
      user = resolve_user_from(email_address)
      product_file_name = ProductFileHandler.persist(user,
product_data, errors)
      if errors.blank?
        # ... do some stuff
        # ... do some other stuff

ProductFileHandler.persist will add any errors it encounters to the
errors array I pass in. In my test of upload, I want to stub that
error array with different values. After much googling and RSpec doc
searching I can't find a way to stub arguments like that? Is this
possible with RSpec?

More information about the rspec-users mailing list