我想用反射來實現Go接口來生成模擬和存根。但如果我看看reflect包,我不知道該怎麼做(也許這是不可能的)。 例如:測試某FUNC呼籲WriteHeader(404)上ResponseWriter: type ResponseWriterMock struct { //
status int //
} // How
我有我在測試條件輸出的視圖規範。如何獲得規範返回我嘲笑的用戶? 查看文件: .content
- if @current_user.is_welcome == true
Welcome to the site
查看規格: before(:each) do
@user = mock_model(User)
@user.stub!(:is_welcome).and_
我有一個模塊「sitescollection」像這樣的屬性: var site = require('./site'); // <- this should be stubbed
var sitesCollection = function(spec) {
var that = {};
that.sites = {};
that.findOrCreateBy