2012-08-10 136 views
12

我想從軌道測試控制檯測試RSpec存根和模擬。可能嗎 ?如果是,如何?從測試控制檯RSpec模擬

這是我的嘗試:

$rails c test 
>require "./spec/spec_helper" 
true 
>source = double('source') 
NoMethodError: undefined method `double' for main:Object 

回答

0

試試這個:

$ RAILS_ENV=test rails c 
+1

這相當於「rails c test」,我相信嗎? – Emil 2012-08-10 14:42:33

+1

不幸的是:http://stackoverflow.com/questions/7668167/rails-console-test-loading-development-environment – Ch4rAss 2012-08-10 14:44:42