我正试图从我的一个规范助手中的模块中访问一个方法
我将模块包含在测试助手中
module Support class RestHelper include Rest::Rest def create_rest_client_for_ifa # Call method from module create_rest_client(uname,pword) end end end
但是当我运行我的规范时,我不断收到NoMethodError:
Failure/Error: @rest_client = Support::RestHelper.create_rest_client_for_ifa NoMethodError: undefined method `create_rest_client' for Support::RestHelper:Class
这是我的模块代码:
module Rest module Rest . . def create_rest_client(uname,pword) # code end . . end end
当我在rails控制台中测试它时似乎工作正常
$RAILS_ENV=test rails c irb> include Rest::Rest => Object irb> create_rest_client(uname,pword)
我错过了什么?为什么我不能从测试助手访问该方法?
任何帮助都感激不尽.
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。