Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RSpec mock from test console

I want to test out RSpec stubbing and mocking from a rails test console . Is it possible ? If yes , how ?

This is what I tried :

$rails c test
>require "./spec/spec_helper"
true
>source = double('source')
NoMethodError: undefined method `double' for main:Object
like image 961
Emil Avatar asked Aug 10 '12 13:08

Emil


1 Answers

You need to require 'rspec/mocks/standalone', as stated in the documentation.

like image 164
Myron Marston Avatar answered Oct 21 '22 08:10

Myron Marston