[英]RSpec testing module methods/
我有下一个模块。
module A
module B
def self.method_b(value)
#code
end
end
end
和
module A
module C
def self.method_c(value)
A::B.method_b(value)
end
end
end
如何测试这些模块? 如何创建存根self.method_b?
spec_helper.rb
RSpec.configure do |config|
config.mock_with :mocha
end
谢谢。
您已经关闭了用于Mocha的内置RSpec模拟库。 那有一个不同的API 。 尝试:
A::B.stubs(:method_b).returns('value')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.