ruby – 在特定命名空间中测试
发布时间:2020-12-17 03:04:34 所属栏目:百科 来源:网络整理
导读:我正在尝试在命名空间中测试一些类,目前我有这样的代码: describe Server::SessionController do it "should create session" do Server::LoginController.stub(:authenitcate).and_return(session_id) Server::SessionController.... Server::SessionContr
我正在尝试在命名空间中测试一些类,目前我有这样的代码:
describe Server::SessionController do it "should create session" do Server::LoginController.stub(:authenitcate).and_return(session_id) Server::SessionController.... Server::SessionController.... end end 如何摆脱可重复的Server命名空间? 解决方法
RSpec Book(
http://pragprog.com/book/achbd/the-rspec-book)提供了一个解决方案:
3 module Codebreaker 4 describe Game do 5 describe "#start" do
因此,尝试将您的规范放在服务器模块中.HTH. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |