我对Ruby和RSpec非常陌生。我想创建基本规格文件中查找该模块:测试Ruby模块
module DownloadAttemptsHelper
def download_attempt_filter_select_options
search_types = [
[I18n.t("helpers.download_attempts.search_types_default"), 'default' ],
[I18n.t("helpers.download_attempts.search_types_account_id"), 'account_id' ],
[I18n.t("helpers.download_attempts.search_types_remote_ip"), 'remote_ip' ],
]
options_for_select(search_types)
end
end
小试
describe DownloadAttemptsHelper do
it "does something" do
expect(1).to be_odd
end
end
我得到:
`<top (required)>': uninitialized constant DownloadAttemptsHelper (NameError)
我需要导入的目录路径和模块的名称? 你可以给我一些非常基本的例子,我如何测试这个模块?
有很多教程和指南,在互联网,如何编写规格,你尝试过什么? –
是的,但我对这种语言太陌生了。你能给我一些基本的例子吗? –
这不是一种语言,它是一个测试框架。这里是谷歌的第一个链接。 https://www.codeschool.com/courses/testing-with-rspec –