Ruby on rails 方法在rails控制台中工作,但rspec说方法未定义

Ruby on rails 方法在rails控制台中工作,但rspec说方法未定义,ruby-on-rails,ruby,rspec,Ruby On Rails,Ruby,Rspec,在我的rails 3应用程序中,我有一个lib文件夹: /lib /lib/abc/some_class.rb /lib/abc/some_class/other.rb 某些_class.rb: module ABC class SomeClass end end 其他.rb module ABC class SomeClass::Other def self.hello(a,b,c,) false end end end 如果我启动rails控

在我的rails 3应用程序中,我有一个lib文件夹:

/lib
/lib/abc/some_class.rb
/lib/abc/some_class/other.rb
某些_class.rb:

module ABC
  class SomeClass
  end
end
其他.rb

module ABC
  class SomeClass::Other
    def self.hello(a,b,c,)
      false
    end
  end
end
如果我启动rails控制台,我可以执行以下操作:

ABC::SomeClass::Other.hello(1,2,3)
并且它输出false

在我的rspec测试中,我有相同的行:

result = ABC::SomeClass::Other.hello(1,2,3)
我得到:

undefined method 'hello' for #<Class:0x.......>
的未定义方法“hello”#

这是名称空间问题吗?文件夹问题?

rspec文件中有哪些要求?它需要在my application.rb中包含一些\u class.rb和一些\u class\other.rb(您可能需要修改加载路径以同时包含这两个)

我已经在自动加载/lib文件夹中的所有文件。某些类已经开始工作,就在我添加文件夹some\u class\other.rb时,我遇到了这个问题。这是否需要在我的spec\u helper或@Blankman中?请发布或简要说明这些测试的spec文件。require可以在任意一个中,它只是需要。这里的最佳实践是在需要它的文件(spec文件)中要求它,但是如果在整个项目中使用这个类,那么就把require放在helper中